mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Merge pull request #3171 from rust-lang-nursery/README-tool-lints
README: More detailed explanation of tool_lints
This commit is contained in:
commit
d15b6009ee
1 changed files with 16 additions and 1 deletions
17
README.md
17
README.md
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue