summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cmp_nan.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/cmp_nan.txt')
-rw-r--r--src/tools/clippy/src/docs/cmp_nan.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/cmp_nan.txt b/src/tools/clippy/src/docs/cmp_nan.txt
new file mode 100644
index 000000000..e2ad04d93
--- /dev/null
+++ b/src/tools/clippy/src/docs/cmp_nan.txt
@@ -0,0 +1,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() { }
+``` \ No newline at end of file