summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cmp_nan.txt
blob: e2ad04d932359aa55e6cf5b1e0fd03e93aeeb8ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Checks for comparisons to NaN.

### Why is this bad?
NaN does not compare meaningfully to anything – not
even itself – so those comparisons are simply wrong.

### Example
```
if x == f32::NAN { }
```

Use instead:
```
if x.is_nan() { }
```