]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/cmp_nan.txt
Rollup merge of #101740 - andrewpollack:add-ignore-fuchsia-ui-tests, r=tmandry
[rust.git] / src / tools / clippy / src / docs / cmp_nan.txt
1 ### What it does
2 Checks for comparisons to NaN.
3
4 ### Why is this bad?
5 NaN does not compare meaningfully to anything – not
6 even itself – so those comparisons are simply wrong.
7
8 ### Example
9 ```
10 if x == f32::NAN { }
11 ```
12
13 Use instead:
14 ```
15 if x.is_nan() { }
16 ```