-
Notifications
You must be signed in to change notification settings - Fork 1.7k
parameter only used in recursion false positive #8629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Maybe another similar false-positive example: fn doing_thing(x: i32, y: i32) -> i32 {
let mut diff = x ^ y;
let mut distance = 0;
for _ in 0..32 {
if diff & 1 > 0 {
distance += 1;
}
diff >>= 1;
}
distance
}
fn main() {
println!("{}", doing_thing(100, 100));
} Clippy returned:
|
@tony84727 this is somewhat the same pattern as mine: pub fn doing_thing(x: i32, y: i32) {
let _diff = x ^ y;
}
But yeah, that should be fixed to. I try to investigate this a little bit further. |
@buttercrab can you help us here? :) |
@hellow554 I'll change the algorithm as soon as I can. |
No need to hurry! Take your time. I just wanted to know, if you know what could cause this. Sorry for the scare |
this is causing a false positive in |
Summary
The lint triggers even when there's no recursion and it is "used"
Lint Name
only_used_in_recursion
Reproducer
I tried this code:
I saw this happen:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: