Clippy is a linter for Rust that catches common mistakes and suggests improvements to your code. It provides over 800 lints organized into categories with configurable severity levels, from correctness checks that catch outright bugs to style suggestions and experimental lints still under development.
The tool works by analyzing Rust code during compilation and flagging patterns that are incorrect, suspicious, inefficient, or non-idiomatic. Lints are grouped into categories such as correctness (enabled by default and set to deny), suspicious (warn), style (warn), complexity (warn), performance (warn), pedantic (allow by default), restriction (allow by default), nursery (allow by default), and cargo (allow by default). This categorization lets you choose how strictly Clippy enforces suggestions: you can enable only the most critical checks or adopt stricter standards across your codebase. The restriction category is explicitly designed for case-by-case adoption rather than wholesale enablement, as its lints may flag valid code or contradict each other.
Clippy suits any Rust project that wants to improve code quality and catch bugs early. It integrates directly into the standard Rust toolchain via rustup and runs as a cargo subcommand, making adoption straightforward. The tool can automatically apply some of its suggestions using the --fix flag. Teams with strict coding standards can selectively enable lints from the restriction category to enforce project-specific rules, such as preventing unwrap calls in certain functions or disallowing floating-point arithmetic in critical modules.
The project maintains a steady stream of new lints added to the nursery category before graduation to stable categories. Issues are actively filed and addressed for lint improvements and new suggestions. Development focuses on expanding lint coverage while managing the balance between catching real problems and avoiding false positives, particularly in the pedantic category where occasional false positives are acknowledged.