blob: 03b47905a2118dc9e267293da15fed814ddabc42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
### What it does
Checks for implicit saturating subtraction.
### Why is this bad?
Simplicity and readability. Instead we can easily use an builtin function.
### Example
```
let mut i: u32 = end - start;
if i != 0 {
i -= 1;
}
```
Use instead:
```
let mut i: u32 = end - start;
i = i.saturating_sub(1);
```
|