needless_pass_by_ref_mut
false positive in closure
#11561
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
I have a closure that captures
&mut impl FnMut
and calls it, and this lint thinks it doesn't need to be mutable.I can reproduce this on
1.73.0-beta.7
and1.74.0-nightly (13e6f24b9 2023-09-23)
, as well as my own compilation of clippy master(aa137a7e5705 2023-09-24)
.Lint Name
needless_pass_by_ref_mut
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No lint, as it must be
&mut
to be callable in the closure.The suggested change to
&impl FnMut
is an error:Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: