You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
apparently we detect boolan expressions of the form x == y but we don't detect fn(&self) -> bool ones???
I get it that this can be iffy if sideeffects are involved but in this example the fn does not even need &mut self :/
Could we somehow warn here for const-fns at least maybe?
Lint Name
ifs_same_cond
Reproducer
I tried this code:
pubfnmain(){let a = Some(32);ifletSome(32) = a {let b = String::from("x");if b.contains("ah"){// same aseprintln!("AAA");}elseif b.contains("ah"){// hereprintln!("AAA");}}}
enhance [`ifs_same_cond`] to warn same immutable method calls as well
fixes: #10272
---
changelog: Enhancement: [`ifs_same_cond`]: Now also detects immutable method calls.
[#10350](#10350)
<!-- changelog_checked -->
Summary
apparently we detect boolan expressions of the form
x == y
but we don't detectfn(&self) -> bool
ones???I get it that this can be iffy if sideeffects are involved but in this example the fn does not even need
&mut self
:/Could we somehow warn here for const-fns at least maybe?
Lint Name
ifs_same_cond
Reproducer
I tried this code:
I expected to see this happen:
clippy warning
Instead, this happened:
Version
The text was updated successfully, but these errors were encountered: