Skip to content

Only invoke the Clippy wrapper for the leaf crate #2155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions collector/src/compile/execute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,11 @@ impl<'a> CargoProcess<'a> {
let mut cmd = self.base_command(self.cwd, cargo_subcommand);
cmd.arg("-p").arg(self.get_pkgid(self.cwd)?);
match self.profile {
Profile::Check => {
Profile::Check | Profile::Clippy => {
cmd.arg("--profile").arg("check");
}
Profile::Debug => {}
Profile::Doc => {}
Profile::Clippy => {
cmd.arg("--profile").arg("check");
// For Clippy, we still invoke `cargo rustc`, but we need to override the
// executed rustc to be clippy-fake.
cmd.env("RUSTC", &*FAKE_CLIPPY);
}
Profile::Opt => {
cmd.arg("--release");
}
Expand All @@ -366,6 +360,15 @@ impl<'a> CargoProcess<'a> {
// onto rustc for the final crate, which is exactly the crate for which
// we want to wrap rustc.
if needs_final {
if let Profile::Clippy = self.profile {
// For Clippy, we still invoke `cargo rustc`, but we need to override the
// executed rustc to be clippy-fake.
// We only do this for the final crate, otherwise clippy would be invoked by
// cargo also for building host code (build scripts/proc macros), which doesn't
// really work.
cmd.env("RUSTC", &*FAKE_CLIPPY);
}

let processor = self
.processor_etc
.as_mut()
Expand Down
Loading