summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cmp_null.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/cmp_null.txt')
-rw-r--r--src/tools/clippy/src/docs/cmp_null.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/cmp_null.txt b/src/tools/clippy/src/docs/cmp_null.txt
new file mode 100644
index 000000000..02fd15124
--- /dev/null
+++ b/src/tools/clippy/src/docs/cmp_null.txt
@@ -0,0 +1,23 @@
+### What it does
+This lint checks for equality comparisons with `ptr::null`
+
+### Why is this bad?
+It's easier and more readable to use the inherent
+`.is_null()`
+method instead
+
+### Example
+```
+use std::ptr;
+
+if x == ptr::null {
+ // ..
+}
+```
+
+Use instead:
+```
+if x.is_null() {
+ // ..
+}
+``` \ No newline at end of file