]> git.lizzy.rs Git - rust.git/blob - src/docs/alloc_instead_of_core.txt
Auto merge of #9425 - kraktus:patch-1, r=xFrednet
[rust.git] / src / docs / alloc_instead_of_core.txt
1 ### What it does
2
3 Finds items imported through `alloc` when available through `core`.
4
5 ### Why is this bad?
6
7 Crates which have `no_std` compatibility and may optionally require alloc may wish to ensure types are
8 imported from core to ensure disabling `alloc` does not cause the crate to fail to compile. This lint
9 is also useful for crates migrating to become `no_std` compatible.
10
11 ### Example
12 ```
13 use alloc::slice::from_ref;
14 ```
15 Use instead:
16 ```
17 use core::slice::from_ref;
18 ```