summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/zero_ptr.txt
blob: e768a02366009d0086fdc2ea89896430d7e6cfb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Catch casts from `0` to some pointer type

### Why is this bad?
This generally means `null` and is better expressed as
{`std`, `core`}`::ptr::`{`null`, `null_mut`}.

### Example
```
let a = 0 as *const u32;
```

Use instead:
```
let a = std::ptr::null::<u32>();
```