arithmetic_side_effects: can’t see through trivial constant items #10209
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
arithmetic_side_effects
lint correctly considers operations such as(somevar: u64) / 2
as non-side-effectful. However as soon as2
is extracted into a constant, the lint starts firing.I don't think it is critical that we handle complex constant evaluation here, but it would be nice if it handled at least basic literals like that so that this lint didn't become a motivation to inline magic numbers into the code.
Lint Name
arithmetic_side_effects
Reproducer
I tried this code:
I saw this happen:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: