error: unused variable: `x` when lint set to deny in Cargo.toml
0 reputation · 01 Nov 2025, 21:37 UTC
Goal: configure Rust compiler lints so that useful alerts about unused variables and other code quality issues are visible, while reducing irrelevant noise that can hide genuine problems.
Constraints: deciding which lints to promote to error level, which to keep as warnings, and how to apply temporary overrides via cargo clippy flags or RUSTFLAGS without affecting external crates or causing instability on older toolchains where certain lints may not exist.
What combination of lint levels in Cargo.toml and clippy flags provides actionable alerts for unused variables without silencing other useful warnings?
Which approach scopes temporary lint adjustments to the current crate only, ensuring dependencies retain their default lint behavior?
Which strategy prevents inadvertently promoting unstable lints to forbid, which could break builds on older Rust releases?