RS.CLIPPY.MODULO_ONE
Taking an integer modulo +/-1, which can either panic/overflow or always returns 0
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: modulo_one. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for getting the remainder of integer division by one or minus one.
Why is this bad?
The result for a divisor of one can only ever be zero; for minus one it can cause panic/overflow (if the left operand is the minimal value of the respective integer type) or results in zero. No one will write such code deliberately, unless trying to win an Underhanded Rust Contest. Even for that contest, it's probably a bad idea. Use something more underhanded.
Example
let a = x % 1;
let a = x % -1;