]> git.lizzy.rs Git - rust.git/blob - src/docs/useless_attribute.txt
Add iter_kv_map lint
[rust.git] / src / docs / useless_attribute.txt
1 ### What it does
2 Checks for `extern crate` and `use` items annotated with
3 lint attributes.
4
5 This lint permits lint attributes for lints emitted on the items themself.
6 For `use` items these lints are:
7 * deprecated
8 * unreachable_pub
9 * unused_imports
10 * clippy::enum_glob_use
11 * clippy::macro_use_imports
12 * clippy::wildcard_imports
13
14 For `extern crate` items these lints are:
15 * `unused_imports` on items with `#[macro_use]`
16
17 ### Why is this bad?
18 Lint attributes have no effect on crate imports. Most
19 likely a `!` was forgotten.
20
21 ### Example
22 ```
23 #[deny(dead_code)]
24 extern crate foo;
25 #[forbid(dead_code)]
26 use foo::bar;
27 ```
28
29 Use instead:
30 ```
31 #[allow(unused_imports)]
32 use foo::baz;
33 #[allow(unused_imports)]
34 #[macro_use]
35 extern crate baz;
36 ```