]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/book/src/README.md
Merge commit '4bdfb0741dbcecd5279a2635c3280726db0604b5' into clippyup
[rust.git] / src / tools / clippy / book / src / README.md
1 # Clippy
2
3 [![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test%20(bors)/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test+(bors)%22+event%3Apush+branch%3Aauto)
4 [![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)
5
6 A collection of lints to catch common mistakes and improve your
7 [Rust](https://github.com/rust-lang/rust) code.
8
9 [There are over 550 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
10
11 Lints are divided into categories, each with a default [lint
12 level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how
13 much Clippy is supposed to ~~annoy~~ help you by changing the lint level by
14 category.
15
16 | Category              | Description                                                                         | Default level |
17 | --------------------- | ----------------------------------------------------------------------------------- | ------------- |
18 | `clippy::all`         | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
19 | `clippy::correctness` | code that is outright wrong or useless                                              | **deny**      |
20 | `clippy::suspicious`  | code that is most likely wrong or useless                                           | **warn**      |
21 | `clippy::complexity`  | code that does something simple but in a complex way                                | **warn**      |
22 | `clippy::perf`        | code that can be written to run faster                                              | **warn**      |
23 | `clippy::style`       | code that should be written in a more idiomatic way                                 | **warn**      |
24 | `clippy::pedantic`    | lints which are rather strict or might have false positives                         | allow         |
25 | `clippy::nursery`     | new lints that are still under development                                          | allow         |
26 | `clippy::cargo`       | lints for the cargo manifest                                                        | allow         |                                   | allow         |
27
28 More to come, please [file an
29 issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
30
31 The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also
32 contains "restriction lints", which are for things which are usually not
33 considered "bad", but may be useful to turn on in specific cases. These should
34 be used very selectively, if at all.