Keyboard shortcuts
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
Clippy
A collection of lints to catch common mistakes and improve your Rust code.
There are over 800 lints included in this crate!
Lints are divided into categories, each with a default lint
level. You can choose how
much Clippy is supposed to annoy help you by changing the lint level by
category.
More to come, please file an issue if you have ideas!
The restriction category should, emphatically, not be enabled as a whole. The contained
lints may lint against perfectly reasonable code, may not have an alternative suggestion,
and may contradict any other lints (including other categories). Lints should be considered
on a case-by-case basis before enabling.
-
Some use cases for
restrictionlints include:- Strict coding styles (e.g.
clippy::else_if_without_else). - Additional restrictions on CI (e.g.
clippy::todo). - Preventing panicking in certain functions (e.g.
clippy::unwrap_used). - Running a lint only on a subset of code (e.g.
#[forbid(clippy::float_arithmetic)]on a module).
- Strict coding styles (e.g.
