modulo_arithmetic
should not trigger if result is only checked to be zero or non-zero
#12006
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
A common usage of
%
is to check exact divisibility, and I believe%
andrem_euclid
output0
for exactly the same set of inputs. Soa % b == 0
ora % b != 0
should not trigger the lint.Lint Name
modulo_arithmetic
Reproducer
I tried this code:
I saw this happen: The lint
modulo_arithmetic
triggers and suggests usingrem_euclid
.I expected to see this happen: Nothing.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: