Bad suggestion for &mut *(&mut &mut T)
from clippy::needless_borrow
#8191
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
clippy::needless_borrow
suggested a change that only works if the compiler was going to reborrow the reference or the reference could be moved/copied. Since neither conditions were true the suggested code produced an error.Reproducer
I originally encounter the issue here
https://github.com/bevyengine/bevy/blob/601cc0cbe3dc73c0db1993184f4ec47783e83884/crates/bevy_ecs/src/bundle.rs#L492
A reduced version:
I expected to see this happen:
cargo clippy --fix
should changeOuter::InnerBorrowed(inner) => &mut *inner,
intoOuter::InnerBorrowed(inner) => inner,
Instead, this happened:
cargo clippy --fix
tries to changeOuter::InnerBorrowed(inner) => &mut *inner,
intoOuter::InnerBorrowed(inner) => *inner,
and then produces the following console outputConsole Output
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: