Skip to content

Commit a9634fc

Browse files
committed
Unstable book documentation of tool lints
1 parent dddb8d2 commit a9634fc

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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.

0 commit comments

Comments
 (0)