# Clippy

Clippy is the official Rust linter, distributed as a `rustup` component (`rustup component add clippy`) and run via `cargo clippy`. It ships hundreds of lints organized into ten categories: Correctness, Suspicious, Complexity, Perf, Style, Pedantic, Restriction, Cargo, Nursery, Deprecated.

A Clippy config has two surfaces:

- **`Cargo.toml` `[lints.clippy]` (or `[workspace.lints.clippy]`)** — turns lints on/off and sets their severity (`warn`, `deny`, `allow`).
- **`clippy.toml`** — config knobs for individual lints, including test-mode relaxations (e.g., `allow-unwrap-in-tests = true`).

## Categories aren't toggle switches

The category groupings are loose. `restriction` in particular is documented as "should *emphatically* not be enabled as a whole" — it contains mutually-contradictory lints (e.g., `big_endian_bytes` and `little_endian_bytes`). There's even a meta-lint, `blanket_clippy_restriction_lints`, to catch you trying. The Clippy docs recommend selective opt-in.

## Workspace inheritance gotcha

Workspace `[workspace.lints.clippy]` does not auto-inherit. Each member crate must opt in with `lints.workspace = true`. Nightly has a `missing_lints_inheritance` lint to enforce it; on stable, the `cargo-workspace-lints` tool or a CI shell script is the workaround.

## Coverage in the wiki

- [[clippy-stricter-config]] — Evan Schwartz's curated list of lints for catching panics, dropped futures, swallowed errors, and async footguns; framed as guardrails for coding agents.

## Links

- Lint index: <https://rust-lang.github.io/rust-clippy/master/index.html>
- Docs: <https://doc.rust-lang.org/stable/clippy/>
