Closed
Description
Even though both lints can live separated, perhaps it might be worth considering deprecating integer_arithmetic
in favor of arithmetic_side_effects
.
arithmetic_side_effects
can detect arithmetic operations of any type, not only integers, which prevents more runtime overflows or panics.integer_arithmetic
fires on trivial operations that in fact shouldn't be linted. On the other hand,arithmetic_side_effects
is smarter.
2.1.Adding or Subtracting 0
¹: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=8c37520d26e4e59a85b419efc32c02c8
2.2.Multiplying 1 or 0
¹: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=5e95f95870e7cb6d6c3df178b98c2bd2
2.3.CTFE
: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=5144fb63c938b3796e65f91007eae9b0
2.4.References
: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=46c03f3b0851c376113f8ea161e92d08
2.5. You can take a look at other spotted cases in https://github.com/rust-lang/rust-clippy/pulls?q=is%3Apr+author%3Ac410-f3r+is%3Aclosed.
¹: Used to reinforce the arguments. It its known that no_effect
and similar exist.
Metadata
Metadata
Assignees
Labels
No labels