about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-01-01 09:41:39 +0300
committeronur-ozkan <work@onurozkan.dev>2024-01-01 09:41:39 +0300
commit96bd9cdcc4b70262c1d125794e7ab751f370d587 (patch)
treeb6d117ea06ced29f98ad9bf8649c8b22d4600e66 /src/bootstrap
parente51e98dde6a60637b6a71b8105245b629ac3fe77 (diff)
pass allow-{dirty,staged} to clippy
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/check.rs13
-rw-r--r--src/bootstrap/src/core/config/flags.rs4
2 files changed, 16 insertions, 1 deletions
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<String> {
         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<String> {
                 // 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<String> = 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<String>,