]> git.lizzy.rs Git - rust.git/blob - src/docs/cmp_null.txt
Add iter_kv_map lint
[rust.git] / src / docs / cmp_null.txt
1 ### What it does
2 This lint checks for equality comparisons with `ptr::null`
3
4 ### Why is this bad?
5 It's easier and more readable to use the inherent
6 `.is_null()`
7 method instead
8
9 ### Example
10 ```
11 use std::ptr;
12
13 if x == ptr::null {
14     // ..
15 }
16 ```
17
18 Use instead:
19 ```
20 if x.is_null() {
21     // ..
22 }
23 ```