summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cmp_null.txt
blob: 02fd15124f0389b6e7c0ba637fddb737d39f8df2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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() {
    // ..
}
```