]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/language-features/tool-lints.md
Remove incorrect span for second label inner macro invocation
[rust.git] / src / doc / unstable-book / src / language-features / tool-lints.md
1 # `tool_lints`
2
3 The tracking issue for this feature is: [#44690]
4
5 [#44690]: https://github.com/rust-lang/rust/issues/44690
6
7 ------------------------
8
9 Tool lints let you use scoped lints, to `allow`, `warn`, `deny` or `forbid` lints of
10 certain tools.
11
12 Currently `clippy` is the only available lint tool.
13
14 It is recommended for lint tools to implement the scoped lints like this:
15
16 - `#[_(TOOL_NAME::lintname)]`: for lint names
17 - `#[_(TOOL_NAME::lintgroup)]`: for groups of lints
18 - `#[_(TOOL_NAME::all)]`: for (almost[^1]) all lints
19
20 ## An example
21
22 ```rust
23 #![feature(tool_lints)]
24
25 #![warn(clippy::pedantic)]
26
27 #[allow(clippy::filter_map)]
28 fn main() {
29     let v = vec![0; 10];
30     let _ = v.into_iter().filter(|&x| x < 1).map(|x| x + 1).collect::<Vec<_>>();
31     println!("No filter_map()!");
32 }
33 ```
34
35 [^1]: Some defined lint groups can be excluded here.