Idiomatic Is Not Pedantic-Clean

Idiomatic is not pedantic-clean

Running clippy -W clippy::pedantic -W clippy::nursery on Spotuify produced 2014 warnings. The instinct is to treat that as 2014 problems. It's closer to 150 problems and 1850 lines of opinion you should switch off. Equating "idiomatic" with "zero pedantic warnings" is how you turn a clean codebase into a giant churny diff that catches no bugs.

The clippy groups, by whether to trust them

The noise, by name

About 90% of that 2014 was the lints every mature project allows:

And the one that looks scary but isn't: 287 unwrap() warnings, every single one inside #[cfg(test)] or a tests/ dir. unwrap in tests is correct — a failed unwrap is the test failure. The fix is not to remove them; it's to gate the lint by target.

Gate unwrap by target, don't ban it

The pattern that lets you forbid unwrap in production while keeping it in tests, straight from spotuify's CI:

# production code: strict
cargo clippy --workspace --locked -- -D warnings
# test code: same strictness, minus the test-friendly lints
cargo clippy --workspace --tests --locked -- -D warnings \
  -A clippy::panic -A clippy::unwrap_used

Two passes. The -A flags on the second are why the 287 test unwraps aren't failures. A rubric that counts them as violations is measuring the wrong thing.

The signal that's left

Strip the noise and ~150 warnings remain that are worth fixing: redundant_clone, redundant_closure, map_unwrap_or (prefer map_or), uninlined_format_args, needless_pass_by_value (especially &PathBuf where &Path belongs), match_same_arms, unnecessary_wraps, unused_async. These are mechanical, behaviour-preserving, and clippy will often --fix them for you. That's the list a rubric should enforce — and "enforce" means ratchet each one into [workspace.lints] so it stays fixed, not just fix it once (Ratchet Lints Into the Build). The same sweep on Mxr (4640 warnings, 26 crates) boiled down to 11 lints worth gating CI on. See Idiomatic Rust Rubric for where this sits in the bigger picture.

See also