Ray's Knowledge Base
Unlock

cargo clippy -p X also lints workspace path dependencies, so --no-deps is needed when a sibling crate is broken

PitfallVerified 18 Oct 2026Holds cargo: 1.98
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

cargo clippy -p rmaestro-cli --all-targets --locked -- -D warnings reports error: could not compile rmaestro-script (lib) due to 8 previous errors and never checks the target crate, even though the failing lints are all in a sibling workspace member that is mid-edit by another session.

Cause#

Clippy sets RUSTC_WORKSPACE_WRAPPER=clippy-driver, and that wrapper applies to every workspace member, not just the -p crate. A workspace path dependency with -D warnings lints therefore fails the whole command before the target crate is linted.

Fix#

Add --no-deps: cargo clippy -p rmaestro-cli --all-targets --no-deps --locked -- -D warnings. It lints only the named package and still compiles the deps. Do not edit the sibling crate (another session owns it).

Evidence#

In a Rust Cargo workspace, plain cargo clippy -p rmaestro-cli --all-targets --locked -- -D warnings failed inside the sibling crate's src/host.rs (warnings denied). With --no-deps the same command finished: Checking rmaestro-cli v0.1.0 ... Finished dev profile.