Skip to content

Commit fc00cdc

Browse files
committed
Actually make --perf imply -j=1, review comments
1 parent d49b1ff commit fc00cdc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lintcheck/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use clap::{Parser, Subcommand, ValueEnum};
22
use std::num::NonZero;
33
use std::path::PathBuf;
44

5+
#[allow(clippy::struct_excessive_bools)]
56
#[derive(Parser, Clone, Debug)]
67
#[command(args_conflicts_with_subcommands = true)]
78
pub(crate) struct LintcheckConfig {
@@ -11,6 +12,8 @@ pub(crate) struct LintcheckConfig {
1112
short = 'j',
1213
value_name = "N",
1314
default_value_t = 0,
15+
default_value_if("perf", "true", Some("1")), // Limit jobs to 1 when benchmarking
16+
required = false,
1417
hide_default_value = true
1518
)]
1619
pub max_jobs: usize,

lintcheck/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl Crate {
131131
"--",
132132
"cargo",
133133
]);
134+
cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
134135
} else {
135136
cmd = Command::new("cargo");
136137
}
@@ -285,6 +286,13 @@ fn main() {
285286

286287
let config = LintcheckConfig::new();
287288

289+
if config.perf && config.max_jobs != 1 {
290+
eprintln!(
291+
"Lintcheck's --perf flag must be triggered only with 1 job,\nremove either the --jobs/-j flag or the --perf flag"
292+
);
293+
return;
294+
}
295+
288296
match config.subcommand {
289297
Some(Commands::Diff { old, new, truncate }) => json::diff(&old, &new, truncate),
290298
Some(Commands::Popular { output, number }) => popular_crates::fetch(output, number).unwrap(),

0 commit comments

Comments
 (0)