Merge pull request #3171 from rust-lang-nursery/README-tool-lints

README: More detailed explanation of tool_lints
This commit is contained in:
Manish Goregaokar 2018-09-13 15:06:54 +05:30 committed by GitHub
commit d15b6009ee
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