]> git.lizzy.rs Git - rust.git/blob - src/docs/std_instead_of_alloc.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / std_instead_of_alloc.txt
1 ### What it does
2
3 Finds items imported through `std` when available through `alloc`.
4
5 ### Why is this bad?
6
7 Crates which have `no_std` compatibility and require alloc may wish to ensure types are imported from
8 alloc to ensure disabling `std` does not cause the crate to fail to compile. This lint is also useful
9 for crates migrating to become `no_std` compatible.
10
11 ### Example
12 ```
13 use std::vec::Vec;
14 ```
15 Use instead:
16 ```
17 use alloc::vec::Vec;
18 ```