]> git.lizzy.rs Git - rust.git/blob - src/docs/unused_rounding.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / unused_rounding.txt
1 ### What it does
2
3 Detects cases where a whole-number literal float is being rounded, using
4 the `floor`, `ceil`, or `round` methods.
5
6 ### Why is this bad?
7
8 This is unnecessary and confusing to the reader. Doing this is probably a mistake.
9
10 ### Example
11 ```
12 let x = 1f32.ceil();
13 ```
14 Use instead:
15 ```
16 let x = 1f32;
17 ```