Skip to content

Fix Clippy benchmarks #2154

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 3 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion collector/src/bin/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ struct CompileTimeOptions {
#[arg(long)]
rustdoc: Option<PathBuf>,

/// The path to the local clippy to measure
/// The path to the local clippy to measure.
/// It should be a path to the `clippy-driver` binary.
#[arg(long)]
clippy: Option<PathBuf>,
}
Expand Down
9 changes: 7 additions & 2 deletions collector/src/compile/execute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl<'a> CargoProcess<'a> {
};

if let Some(c) = &self.toolchain.components.clippy {
cmd.env("CLIPPY", &*FAKE_CLIPPY).env("CLIPPY_REAL", c);
cmd.env("CLIPPY_REAL", c);
}

for config in &self.toolchain.components.cargo_configs {
Expand Down Expand Up @@ -335,7 +335,12 @@ impl<'a> CargoProcess<'a> {
}
Profile::Debug => {}
Profile::Doc => {}
Profile::Clippy => {}
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 Down
6 changes: 3 additions & 3 deletions collector/src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl SysrootDownload {
let components = ToolchainComponents::from_binaries_and_libdir(
sysroot_bin("rustc")?,
Some(sysroot_bin("rustdoc")?),
sysroot_bin("cargo-clippy").ok(),
sysroot_bin("clippy-driver").ok(),
sysroot_bin("cargo")?,
&self.directory.join(&self.rust_sha).join("lib"),
)?;
Expand Down Expand Up @@ -484,12 +484,12 @@ pub fn get_local_toolchain(
)
} else if profiles.contains(&Profile::Clippy) {
// We need a `clippy`. Look for one next to `rustc`.
if let Ok(clippy) = rustc.with_file_name("cargo-clippy").canonicalize() {
if let Ok(clippy) = rustc.with_file_name("clippy-driver").canonicalize() {
debug!("found clippy: {:?}", &clippy);
Some(clippy)
} else {
anyhow::bail!(
"'Clippy' build specified but '--cargo-clippy' not specified and no 'cargo-clippy' found \
"'Clippy' build specified but '--clippy' not specified and no 'clippy-driver' found \
next to 'rustc'"
);
}
Expand Down
Loading