clippy
Rust linter for catching common mistakes
TLDR
SYNOPSIS
cargo clippy [options] [-- clippyoptions_]
DESCRIPTION
clippy is a collection of lints to catch common mistakes and improve Rust code. It provides hundreds of lints covering correctness, style, performance, complexity, and more.Clippy integrates with Cargo and analyzes code during compilation, providing actionable warnings. Lints range from simple style suggestions to detecting subtle bugs and performance issues. Many lints include automatic fixes that can be applied with `--fix`.
PARAMETERS
--fix
Automatically apply lint suggestions.--all-targets
Check all targets including tests and examples.--all-features
Check with all features enabled.--release
Check in release mode.--list
List all available lints.-- -D lint
Deny specific lint (treat as error).-- -W lint
Warn on specific lint.-- -A lint
Allow (ignore) specific lint.-- -F lint
Forbid lint (cannot be overridden).
LINT CATEGORIES
clippy::correctness: Likely bugsclippy::suspicious: Questionable codeclippy::style: Style improvementsclippy::complexity: Overly complex codeclippy::perf: Performance improvementsclippy::pedantic: Stricter lintsclippy::nursery: Experimental lints
CAVEATS
Some lints may produce false positives. The pedantic category is intentionally noisy and should be selectively enabled. Automatic fixes from --fix should be reviewed before committing. Clippy suggestions may occasionally conflict with rustfmt formatting.
HISTORY
clippy was created by Manish Goregaokar and others starting in 2014 as a third-party tool. The name references Microsoft's Office assistant. It became an official Rust component in 2018, distributed via rustup. Clippy has grown to include over 600 lints and is widely used in the Rust ecosystem.
