-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
I accidentally shadowed a variable without knowing and the linter did not warn me about that. Not a huge deal but just wanted to report the issue.
Lint name:
shadow_unrelated
I tried this code:
let s = "&str";
println!("{}", s);
let s = String::from("String");
println!("{}", s);
let x = 1;
println!("{}", x);
let x = "2".parse::<i32>().unwrap();
println!("{}", x);
I expected to see this happen: Warning shown about variables s
and x
being shadowed when running cargo clippy -- -W clippy::shadow_reuse -W clippy::shadow_same -W clippy::shadow_unrelated
.
Instead, this happened: No warning for variable s
was shown.
Meta
Rust version (rustc -Vv
):
rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't