-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
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
Summary
unnecessary_cast
appears to trigger for a parameter, but not for a local.
Lint Name
unnecessary_cast
Reproducer
I tried this code:
fn g() -> i16 { 42 }
pub fn f1() -> i32 {
let x = g();
x as i32 as i32
}
pub fn f2(x: i16) -> i32 {
x as i32 as i32
}
I expected to see this happen: two lints, one on each function.
Instead, this happened: one lint, only on f2
.
Version
rustc 1.83.0-nightly (18b1161 2024-10-02)
binary: rustc
commit-hash: 18b1161
commit-date: 2024-10-02
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
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