Skip to content

Commit d15b600

Browse files
authored
Merge pull request #3171 from rust-lang-nursery/README-tool-lints
README: More detailed explanation of tool_lints
2 parents e840006 + 49b1a8c commit d15b600

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
104104

105105
### Allowing/denying lints
106106

107-
You can add options to `allow`/`warn`/`deny`:
107+
You can add options to your code to `allow`/`warn`/`deny` Clippy lints:
108108

109109
* the whole set of `Warn` lints using the `clippy` lint group (`#![deny(clippy::all)]`)
110110

@@ -118,6 +118,21 @@ You can add options to `allow`/`warn`/`deny`:
118118

119119
Note: `deny` produces errors instead of warnings.
120120

121+
Note: To use the new `clippy::lint_name` syntax, `#![feature(tool_lints)]` has to be activated
122+
currently. If you want to compile your code with the stable toolchain you can use a `cfg_attr` to
123+
activate the `tool_lints` feature:
124+
```rust
125+
#![cfg_attr(feature = "cargo-clippy", feature(tool_lints))]
126+
#![cfg_attr(feature = "cargo-clippy", allow(clippy::lint_name))]
127+
```
128+
129+
For this to work you have to use Clippy on the nightly toolchain: `cargo +nightly clippy`. If you
130+
want to use Clippy with the stable toolchain, you can stick to the old unscoped method to
131+
enable/disable Clippy lints until `tool_lints` are stable:
132+
```rust
133+
#![cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]
134+
```
135+
121136
## Updating rustc
122137

123138
Sometimes, rustc moves forward without Clippy catching up. Therefore updating

0 commit comments

Comments
 (0)