]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/src/docs/cmp_null.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / 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 ```