diff options
| author | blyxyas <blyxyas@gmail.com> | 2025-01-31 16:06:08 +0100 |
|---|---|---|
| committer | blyxyas <blyxyas@gmail.com> | 2025-01-31 16:12:28 +0100 |
| commit | 48ae7ec894ae4749c97358454a926188f579beb4 (patch) | |
| tree | a64338c34faa92a5f2f54f30c73087d89668f523 | |
| parent | fc00cdcf285888a3c029df3ce36cc75692b6140b (diff) | |
| download | rust-48ae7ec894ae4749c97358454a926188f579beb4.tar.gz rust-48ae7ec894ae4749c97358454a926188f579beb4.zip | |
Adress review comments
| -rw-r--r-- | lintcheck/src/config.rs | 1 | ||||
| -rw-r--r-- | lintcheck/src/main.rs | 34 |
2 files changed, 16 insertions, 19 deletions
diff --git a/lintcheck/src/config.rs b/lintcheck/src/config.rs index 408fb162eb6..83c3d7aba02 100644 --- a/lintcheck/src/config.rs +++ b/lintcheck/src/config.rs @@ -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 )] diff --git a/lintcheck/src/main.rs b/lintcheck/src/main.rs index af1b66bd039..8d0d41ab945 100644 --- a/lintcheck/src/main.rs +++ b/lintcheck/src/main.rs @@ -131,7 +131,6 @@ impl Crate { "--", "cargo", ]); - cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true"); } else { cmd = Command::new("cargo"); } @@ -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); @@ -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(), |
