summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/alloc_instead_of_core.txt
blob: 488a36e9276c24d1bd1ded86983a6c423b39c9cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### What it does

Finds items imported through `alloc` when available through `core`.

### Why is this bad?

Crates which have `no_std` compatibility and may optionally require alloc may wish to ensure types are
imported from core to ensure disabling `alloc` does not cause the crate to fail to compile. This lint
is also useful for crates migrating to become `no_std` compatible.

### Example
```
use alloc::slice::from_ref;
```
Use instead:
```
use core::slice::from_ref;
```