PatchRail

Rust lint (clippy) — error[clippy::...] / -D warnings

Log signatures

error: this `if` has identical blocks
warning: clippy::needless_return
could not compile due to clippy errors
note: `-D warnings` implied by `-D clippy::all`

What’s happening

Clippy found lints and the build runs with -D warnings, promoting every warning to a hard error. The structural cause of surprise clippy failures: a Rust toolchain update shipped new lints. Your code didn't change; the linter got stricter. Clippy lints come in tiers (correctness/suspicious lints are near-always real bugs; style/pedantic lints are judgment) — the tier should drive how seriously you take the finding.

Fix playbook

  1. 1Reproduce with the exact CI invocation, including --all-targets (lints in tests/benches don't show without it) and the same toolchain (rustc --version vs CI).
  2. 2cargo clippy --fix handles the mechanical cases; review the diff.
  3. 3Correctness-tier lints: treat as bug reports, fix properly.
  4. 4Style lints you disagree with: #[allow(clippy::lint_name)] at the narrowest scope with a comment — or set project policy in Cargo.toml's [lints] table so the decision is made once, visibly.
  5. 5After a toolchain bump triggers a lint wave: fix in a dedicated PR, separate from feature work.

Prevention

  • Pin the toolchain via rust-toolchain.toml and upgrade it deliberately in its own PR — that converts "CI broke overnight" into "we upgrade Tuesday and fix new lints then."

Triage every red build, not just this one.

This page is one chapter of CI Failure Triage Patterns — 31 failure classes, real log signatures, and full fix playbooks in one PDF.

Get the pack ($19): patchrail.gumroad.com/l/ci-failure-triage

pipx install patchrail