Unstable book documentation of tool lints

This commit is contained in:
flip1995 2018-07-03 13:52:11 +02:00
parent dddb8d2eba
commit a9634fcd01
No known key found for this signature in database
GPG Key ID: 9F184E1164831181
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# `tool_lints`
The tracking issue for this feature is: [#44690]
[#44690]: https://github.com/rust-lang/rust/issues/44690
------------------------
Tool lints let you use scoped lints, to `allow`, `warn`, `deny` or `forbid` lints of
certain tools.
Currently `clippy` is the only available lint tool.
It is recommended for lint tools to implement the scoped lints like this:
- `#[_(TOOL_NAME::lintname)]`: for lint names
- `#[_(TOOL_NAME::lintgroup)]`: for groups of lints
- `#[_(TOOL_NAME::all)]`: for (almost[^1]) all lints
## An example
```rust
#![feature(tool_lints)]
#![warn(clippy::pedantic)]
#[allow(clippy::filter_map)]
fn main() {
let v = vec![0; 10];
let _ = v.into_iter().filter(|&x| x < 1).map(|x| x + 1).collect::<Vec<_>>();
println!("No filter_map()!");
}
```
[^1]: Some defined lint groups can be excluded here.