needless_match falsely suggesting replacement of if let with side effects #8595
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
Clippy is suggesting to replace this complete part of code with just
As the
else
arm has side effects, namely re-filling the Vec should it be empty, the suggestion is simply incorrect in this case.This is especially an issue as this lint is marked as MachineApplicable.
Lint Name
needless_match
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
A correct and working suggestion, or none at all.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: