Skip to content

Commit

Permalink
Adress review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
blyxyas committed Jan 31, 2025
1 parent fc00cdc commit 48ae7ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
1 change: 1 addition & 0 deletions lintcheck/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub(crate) struct LintcheckConfig {
value_name = "N",
default_value_t = 0,
default_value_if("perf", "true", Some("1")), // Limit jobs to 1 when benchmarking
conflicts_with("perf"),
required = false,
hide_default_value = true
)]
Expand Down
34 changes: 15 additions & 19 deletions lintcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ impl Crate {
"--",
"cargo",
]);
cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
} else {
cmd = Command::new("cargo");
}
Expand Down Expand Up @@ -254,17 +253,21 @@ fn normalize_diag(

/// Builds clippy inside the repo to make sure we have a clippy executable we can use.
fn build_clippy(release_build: bool) -> String {
let output = Command::new("cargo")
.args([
"run",
"--bin=clippy-driver",
if release_build { "-r" } else { "" },
"--",
"--version",
])
.stderr(Stdio::inherit())
.output()
.unwrap();
let mut build_cmd = Command::new("cargo");
build_cmd.args([
"run",
"--bin=clippy-driver",
if release_build { "-r" } else { "" },
"--",
"--version",
]);

if release_build {
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
}

let output = build_cmd.stderr(Stdio::inherit()).output().unwrap();

if !output.status.success() {
eprintln!("Error: Failed to compile Clippy!");
std::process::exit(1);
Expand All @@ -286,13 +289,6 @@ fn main() {

let config = LintcheckConfig::new();

if config.perf && config.max_jobs != 1 {
eprintln!(
"Lintcheck's --perf flag must be triggered only with 1 job,\nremove either the --jobs/-j flag or the --perf flag"
);
return;
}

match config.subcommand {
Some(Commands::Diff { old, new, truncate }) => json::diff(&old, &new, truncate),
Some(Commands::Popular { output, number }) => popular_crates::fetch(output, number).unwrap(),
Expand Down

0 comments on commit 48ae7ec

Please sign in to comment.