src/tools/clippy/book/src/README.md MARKDOWN 44 lines View on github.com → Search inside
1# Clippy23[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)45A collection of lints to catch common mistakes and improve your6[Rust](https://github.com/rust-lang/rust) code.78[There are over 800 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)910Lints are divided into categories, each with a default [lint11level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how12much Clippy is supposed to ~~annoy~~ help you by changing the lint level by13category.1415| Category              | Description                                                                         | Default level |16|-----------------------|-------------------------------------------------------------------------------------|---------------|17| `clippy::all`         | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |18| `clippy::correctness` | code that is outright wrong or useless                                              | **deny**      |19| `clippy::suspicious`  | code that is most likely wrong or useless                                           | **warn**      |20| `clippy::style`       | code that should be written in a more idiomatic way                                 | **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::pedantic`    | lints which are rather strict or have occasional false positives                    | allow         |24| `clippy::restriction` | lints which prevent the use of language and library features[^restrict]             | allow         |25| `clippy::nursery`     | new lints that are still under development                                          | allow         |26| `clippy::cargo`       | lints for the cargo manifest                                                        | allow         |2728More to come, please [file an issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!2930The `restriction` category should, *emphatically*, not be enabled as a whole. The contained31lints may lint against perfectly reasonable code, may not have an alternative suggestion,32and may contradict any other lints (including other categories). Lints should be considered33on a case-by-case basis before enabling.3435[^restrict]: Some use cases for `restriction` lints include:36    - Strict coding styles (e.g. [`clippy::else_if_without_else`]).37    - Additional restrictions on CI (e.g. [`clippy::todo`]).38    - Preventing panicking in certain functions (e.g. [`clippy::unwrap_used`]).39    - Running a lint only on a subset of code (e.g. `#[forbid(clippy::float_arithmetic)]` on a module).4041[`clippy::else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else42[`clippy::todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo43[`clippy::unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.