Skip to content

Commit 70fe651

Browse files
authored
Merge pull request #2155 from Kobzol/clippy-fix-final-crate
Only invoke the Clippy wrapper for the leaf crate
2 parents 2e743a6 + 3c46de6 commit 70fe651

File tree

1 file changed

+10
-7
lines changed
  • collector/src/compile/execute

1 file changed

+10
-7
lines changed

collector/src/compile/execute/mod.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,17 +330,11 @@ impl<'a> CargoProcess<'a> {
330330
let mut cmd = self.base_command(self.cwd, cargo_subcommand);
331331
cmd.arg("-p").arg(self.get_pkgid(self.cwd)?);
332332
match self.profile {
333-
Profile::Check => {
333+
Profile::Check | Profile::Clippy => {
334334
cmd.arg("--profile").arg("check");
335335
}
336336
Profile::Debug => {}
337337
Profile::Doc => {}
338-
Profile::Clippy => {
339-
cmd.arg("--profile").arg("check");
340-
// For Clippy, we still invoke `cargo rustc`, but we need to override the
341-
// executed rustc to be clippy-fake.
342-
cmd.env("RUSTC", &*FAKE_CLIPPY);
343-
}
344338
Profile::Opt => {
345339
cmd.arg("--release");
346340
}
@@ -366,6 +360,15 @@ impl<'a> CargoProcess<'a> {
366360
// onto rustc for the final crate, which is exactly the crate for which
367361
// we want to wrap rustc.
368362
if needs_final {
363+
if let Profile::Clippy = self.profile {
364+
// For Clippy, we still invoke `cargo rustc`, but we need to override the
365+
// executed rustc to be clippy-fake.
366+
// We only do this for the final crate, otherwise clippy would be invoked by
367+
// cargo also for building host code (build scripts/proc macros), which doesn't
368+
// really work.
369+
cmd.env("RUSTC", &*FAKE_CLIPPY);
370+
}
371+
369372
let processor = self
370373
.processor_etc
371374
.as_mut()

0 commit comments

Comments
 (0)