needless_borrow
suggestion changes a reference to a move which breaks surrounding code
#8391
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
Summary
Consider
std::io::Read
, which has methods that takeself
, but the trait is also explicitly implemented for&mut R
whereR: Read
.Consider the following code:
a
lets you still user
afterward, butb
does not, because it movesr
into the wrapper.Lint Name
needless_borrow
Reproducer
I ran into this problem with code that uses a reader in a loop, using
take
to read it in chunks, similar to this:Clippy says:
But that won't compile:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: