From 96bd9cdcc4b70262c1d125794e7ab751f370d587 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Mon, 1 Jan 2024 09:41:39 +0300 Subject: pass allow-{dirty,staged} to clippy Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/check.rs | 13 ++++++++++++- src/bootstrap/src/core/config/flags.rs | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index ecaaf91aec1..97a2494370c 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -28,7 +28,9 @@ fn args(builder: &Builder<'_>) -> Vec { arr.iter().copied().map(String::from) } - if let Subcommand::Clippy { fix, allow, deny, warn, forbid, .. } = &builder.config.cmd { + if let Subcommand::Clippy { fix, allow_dirty, allow_staged, allow, deny, warn, forbid } = + &builder.config.cmd + { // disable the most spammy clippy lints let ignored_lints = vec![ "many_single_char_names", // there are a lot in stdarch @@ -49,7 +51,16 @@ fn args(builder: &Builder<'_>) -> Vec { // As a workaround, avoid checking tests and benches when passed --fix. "--lib", "--bins", "--examples", ])); + + if *allow_dirty { + args.push("--allow-dirty".to_owned()); + } + + if *allow_staged { + args.push("--allow-staged".to_owned()); + } } + args.extend(strings(&["--", "--cap-lints", "warn"])); args.extend(ignored_lints.iter().map(|lint| format!("-Aclippy::{}", lint))); let mut clippy_lint_levels: Vec = Vec::new(); diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs index 0b13726081b..8af454001a6 100644 --- a/src/bootstrap/src/core/config/flags.rs +++ b/src/bootstrap/src/core/config/flags.rs @@ -255,6 +255,10 @@ pub enum Subcommand { Clippy { #[arg(long)] fix: bool, + #[arg(long, requires = "fix")] + allow_dirty: bool, + #[arg(long, requires = "fix")] + allow_staged: bool, /// clippy lints to allow #[arg(global(true), short = 'A', action = clap::ArgAction::Append, value_name = "LINT")] allow: Vec, -- cgit 1.4.1-3-g733a5