Incorrect redundant_locals when rebinding to change drop order #11599
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
When using rebinding to reorder Drops,
redundant_locals
is emitted, even though the rebinding is not redundant. This is similar to #11320, but happens without any mutation, Copy, or multiple scopes.Alternatives considered:
drop
explicitly at the end of the function: This code is attempting to be panic-safe, so cleanup should happen in a particular order even in the face of a panic.Lint Name
redundant_locals
Reproducer
I tried this code:
I saw this happen:
But this suggestion changes the behavior of the program.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: