diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/modulo_arithmetic.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/modulo_arithmetic.txt b/src/tools/clippy/src/docs/modulo_arithmetic.txt new file mode 100644 index 000000000..ff7296f3c --- /dev/null +++ b/src/tools/clippy/src/docs/modulo_arithmetic.txt @@ -0,0 +1,15 @@ +### What it does +Checks for modulo arithmetic. + +### Why is this bad? +The results of modulo (%) operation might differ +depending on the language, when negative numbers are involved. +If you interop with different languages it might be beneficial +to double check all places that use modulo arithmetic. + +For example, in Rust `17 % -3 = 2`, but in Python `17 % -3 = -1`. + +### Example +``` +let x = -17 % 3; +```
\ No newline at end of file |