summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/integer_division.txt
blob: f6d3349810ed86f7e0b7b07fa2a0d61e6b450250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
### What it does
Checks for division of integers

### Why is this bad?
When outside of some very specific algorithms,
integer division is very often a mistake because it discards the
remainder.

### Example
```
let x = 3 / 2;
println!("{}", x);
```

Use instead:
```
let x = 3f32 / 2f32;
println!("{}", x);
```