2 Checks any kind of arithmetic operation of any type.
4 Operators like `+`, `-`, `*` or `<<` are usually capable of overflowing according to the [Rust
5 Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow),
6 or can panic (`/`, `%`).
8 Known safe built-in types like `Wrapping` or `Saturing`, floats, operations in constant
9 environments, allowed types and non-constant operations that won't overflow are ignored.
12 For integers, overflow will trigger a panic in debug builds or wrap the result in
13 release mode; division by zero will cause a panic in either mode. As a result, it is
14 desirable to explicitly call checked, wrapping or saturating arithmetic methods.
18 // `n` can be any number, including `i32::MAX`.
19 fn foo(n: i32) -> i32 {
24 Third-party types can also overflow or present unwanted side-effects.
28 use rust_decimal::Decimal;
29 let _n = Decimal::MAX + Decimal::MAX;
33 Custom allowed types can be specified through the "arithmetic-side-effects-allowed" filter.