needless_pass_by_ref_mut: false negative with fn and closures #12588
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-negative
Issue: The lint should have been triggered on code, but wasn't
L-nursery
Lint: Currently in the nursery group
Summary
No clippy warning for
needless_pass_by_ref_mut
when both wrapping fn and closure have mutable args.Discovered while working on rust-lang/rust#123188
checked with clippy from playground 0.1.79 (2024-03-27 c9f8f34)
https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=047b73855da451dd617b8d43557b8d0d
Lint Name
needless_pass_by_ref_mut
Reproducer
I tried this code:
I expected to see this happen:
For
foo
should warn about unused &mut in fn args and closure. Probably should first warn about closure arg, because if closure fixed, it will successfully warn about fn args (as infoo2
)Instead, this happened:
No warn for
foo
Version
No response
The text was updated successfully, but these errors were encountered: