Closed amircodota closed 1 month ago
Same issue with tokio::main
.
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
Ok(())
}
warning: unneeded `return` statement
--> src/main.rs:5:7
|
5 | Ok(())
| ^^^^
|
= 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`
|
5 | OkOk(())
| ~~~~~~
warning: `foo` (bin "foo") generated 1 warning (run `cargo clippy --fix --bin "foo"` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
help: remove `return` | 5 | OkOk(()) | ~~~~~~
Clippy is drunk 🍺
Summary
In the latest nightly, on tokio::test functions, the last assert is flagged with clippy::needless_return
Reproducer
I tried this code:
And ran this
I expected to see this happen:
I expected clippy to pass
Instead, this happened:
It write this error
Version
rustc 1.83.0-nightly (9e394f551 2024-09-25) binary: rustc commit-hash: 9e394f551c050ff03c6fc57f190e0761cf0be6e8 commit-date: 2024-09-25 host: x86_64-unknown-linux-gnu release: 1.83.0-nightly LLVM version: 19.1.0
Additional Labels
No response