unnecessary_lazy_evaluations
gives wrong suggestions for then
#11793
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
In the attached scenario
unnecessary_lazy_evaluations
is triggered, but it gives a wrong suggestion because the lazy expression relies on the fact that's called only when the number is greater than 0 because otherwise always subtracting 1 would result in an underflow.Lint Name
unnecessary_lazy_evaluations
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No lint should be emitted
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: