Closed
Description
Summary
The following file is generating what I believe to be a false positive needless_return
lint when there is no return statement at all:
Lint Name
needless_return
Reproducer
I tried this code:
- Ran
cargo +nightly clippy --workspace
- In the root dir of https://github.com/DioxusLabs/taffy/
- At commit
b66bd6bfaa3368aa105ad01e697ea2ff3da6b11a
(Sorry, I don't have to time to reduce this right now)
I saw this happen:
warning: unneeded `return` statement
--> scripts/gentest/src/main.rs:158:78
|
158 | Command::new("cargo").arg("fmt").current_dir(repo_root).status().unwrap();
| ^
|
= 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`
|
158 | Command::new("cargo").arg("fmt").current_dir(repo_root).status().unwrap()Command::new("cargo").arg("fmt").current_dir(repo_root).status().unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is also a second unrelated warning (but I believe this is legitimate).
I expected to see this happen:
No warning as there is no return statement.
Version
rustc 1.83.0-nightly (eb4e234 2024-10-09)
binary: rustc
commit-hash: eb4e234
commit-date: 2024-10-09
host: aarch64-apple-darwin
release: 1.83.0-nightly
LLVM version: 19.1.1
Also reproduced with slightly older nightly from 2024-10-04. Bug is not present in 1.81.0 stable.
Additional Labels
No response