rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.43k stars 1.54k forks source link

Clippy Uneeded Return #13467

Closed cycle-five closed 3 weeks ago

cycle-five commented 1 month ago

Summary

⋊> lothrop@archimedes ⋊> ~/s/c/v0.3.14 on v0.3.14 ↑ cargo clippy --fix --bin "crack-voting" (base) 07:58:15 Checking crack-voting v0.3.14 (/home/lothrop/src/cracktunes.worktrees/v0.3.14/crack-voting) warning: failed to automatically apply fixes suggested by rustc to crate crack_voting

after fixes were automatically applied the compiler reported errors within these files:

This likely indicates a bug in either rustc or cargo itself, and we would appreciate a bug report! You're likely to see a number of compiler warnings after this message which cargo attempted to fix but failed. If you could open an issue at https://github.com/rust-lang/rust-clippy/issues quoting the full output of this command we'd be very appreciative! Note that you may be able to make some more progress in the near-term fixing code with the --broken-code flag

The following errors were reported: error[E0599]: no method named awaitrun found for opaque type impl std::future::Future<Output = ()> in the current scope --> crack-voting/src/main.rs:7:11 | 7 | run().awaitrun().await; | ^^^^^^^^ method not found in impl Future<Output = ()>

error: aborting due to 1 previous error

For more information about this error, try rustc --explain E0599. Original diagnostics will follow.

warning: unneeded return statement --> crack-voting/src/main.rs:7:16 7 run().await; ^

= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return = note: #[warn(clippy::needless_return)] on by default help: remove return | 7 | run().awaitrun().await; | ~~~~

warning: crack-voting (bin "crack-voting") generated 1 warning (run cargo clippy --fix --bin "crack-voting" to apply 1 suggestion) Finished dev profile [unoptimized + debuginfo] target(s) in 2.87s

Reproducer

I tried this code:

<code>

I expected to see this happen:

Instead, this happened:

Version

No response

Additional Labels

No response

barafael commented 1 month ago

Can reproduce:

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=00d91812b8fb96bb5f3d47950b277d2e

Note it's on 2024 edition.

barafael commented 1 month ago

Duplicates #13458