about summary refs log tree commit diff
diff options
context:
space:
mode:
authorflip1995 <9744647+flip1995@users.noreply.github.com>2018-07-03 13:52:11 +0200
committerflip1995 <9744647+flip1995@users.noreply.github.com>2018-07-04 12:16:46 +0200
commita9634fcd013a31842e551ba30c25e389a5d67bbd (patch)
tree0ad6403ab502647a136803f76c06895d5c2c5171
parentdddb8d2eba04610eca944a659c1906f78d210ab4 (diff)
downloadrust-a9634fcd013a31842e551ba30c25e389a5d67bbd.tar.gz
rust-a9634fcd013a31842e551ba30c25e389a5d67bbd.zip
Unstable book documentation of tool lints
-rw-r--r--src/doc/unstable-book/src/language-features/tool-lints.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/tool-lints.md b/src/doc/unstable-book/src/language-features/tool-lints.md
new file mode 100644
index 00000000000..5c0d33b5ab0
--- /dev/null
+++ b/src/doc/unstable-book/src/language-features/tool-lints.md
@@ -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.