README: More detailed explanation of tool_lints

cc #3164
This commit is contained in:
Philipp Krones 2018-09-13 11:27:01 +02:00 committed by GitHub
parent e8400061bd
commit 49b1a8c775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,7 +104,7 @@ define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
### Allowing/denying lints
You can add options to `allow`/`warn`/`deny`:
You can add options to your code to `allow`/`warn`/`deny` Clippy lints:
* the whole set of `Warn` lints using the `clippy` lint group (`#![deny(clippy::all)]`)
@ -118,6 +118,21 @@ You can add options to `allow`/`warn`/`deny`:
Note: `deny` produces errors instead of warnings.
Note: To use the new `clippy::lint_name` syntax, `#![feature(tool_lints)]` has to be activated
currently. If you want to compile your code with the stable toolchain you can use a `cfg_attr` to
activate the `tool_lints` feature:
```rust
#![cfg_attr(feature = "cargo-clippy", feature(tool_lints))]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::lint_name))]
```
For this to work you have to use Clippy on the nightly toolchain: `cargo +nightly clippy`. If you
want to use Clippy with the stable toolchain, you can stick to the old unscoped method to
enable/disable Clippy lints until `tool_lints` are stable:
```rust
#![cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]
```
## Updating rustc
Sometimes, rustc moves forward without Clippy catching up. Therefore updating