[arithmetic_side_effects] Division by potentially-zero can panic even with Wrapping
#11393
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-negative
Issue: The lint should have been triggered on code, but wasn't
Summary
Division (
/
and%
, i.e.div()
andrem()
) of anycore::num::Wrapping
byWrapping(0)
(of the same type) panics, but thearithmetic_side_effects
lint currently doesn't flag them (as opposed to the same operations with primitive integers).(Note: kind of the opposite of #11392)
Lint Name
arithmetic_side_effects
Reproducer
I tried this code:
(note: compiles but panics with "
attempt to divide by zero
" and "attempt to calculate the remainder with a divisor of zero
")I expected to see this happen:
Instead, this happened:
No warning
Version
The text was updated successfully, but these errors were encountered: