clippy::unnecessary_lazy_evaluations false positive when laziness prevents underflow #10071
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
I have the following code:
Because
pos
may be equal to 0, changing to(pos % n != 0).then_some(pos - 1)
can trigger underflow and hence panic in debug mode. Nonetheless clippy warns:Lint Name
clippy::unnecessary_lazy_evaluations
Reproducer
Cf summary
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: