Open rmalmain opened 3 months ago
cfg(clippy)
is only set for the crates clippy is run on, not dependencies. This is the same for the deprecated cfg(feature = "cargo-clippy")
.
Thank you for the clarification!
If this is the intended behavior, is there a way to enable cfg(clippy)
for dependencies as well?
For now, we solved this by creating a dummy feature that we propagate during clippy runs, but I believe this is definitely not a good approach.
Clippy gets run for dependencies that are in the workspace, so adding [workspace]
to the root package would be enough since it automatically adds path deps to the workspace. I don't think we have this well documented
I can confirm it indeed solved the issue, thank you! I have not been able to see this information in the documentation so far.
It would be very helpful to add a few words about this around here IMHO.
Summary
When using path dependencies in
Cargo.toml
, cargo does not seem to propagate the specialcfg(clippy)
to dependencies correctly. A minimized example is available here.For reference, this issue has been first opened here and then transferred to this repository.
Reproducer
In the minimized example repo, run
cargo clippy --features feature1,feature2
.As far as I understand, it should not trigger a compiler error.
Version
Additional Labels
No response