]> git.lizzy.rs Git - rust.git/commitdiff
x.py clippy: don't run with --all-targets by default
authorMatthias Krüger <matthias.krueger@famsik.de>
Mon, 30 Aug 2021 21:32:57 +0000 (23:32 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Tue, 31 Aug 2021 20:55:15 +0000 (22:55 +0200)
this caused a lot of noise because benchmarks and tests were also checked

src/bootstrap/check.rs

index 4eb335979b983b004efb2a1358a094947f917a64..f5fad4b4136849c8f023eda32bb9d71365f7e1b1 100644 (file)
@@ -107,6 +107,11 @@ fn run(self, builder: &Builder<'_>) {
             add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
         }
 
+        // don't run on std twice with x.py clippy
+        if builder.kind == Kind::Clippy {
+            return;
+        }
+
         // Then run cargo again, once we've put the rmeta files for the library
         // crates into the sysroot. This is needed because e.g., core's tests
         // depend on `libtest` -- Cargo presumes it will exist, but it doesn't
@@ -120,6 +125,7 @@ fn run(self, builder: &Builder<'_>) {
             target,
             cargo_subcommand(builder.kind),
         );
+
         cargo.arg("--all-targets");
         std_cargo(builder, target, compiler.stage, &mut cargo);
 
@@ -192,7 +198,12 @@ fn run(self, builder: &Builder<'_>) {
             cargo_subcommand(builder.kind),
         );
         rustc_cargo(builder, &mut cargo, target);
-        cargo.arg("--all-targets");
+
+        // For ./x.py clippy, don't run with --all-targets because
+        // linting tests and benchmarks can produce very noisy results
+        if builder.kind != Kind::Clippy {
+            cargo.arg("--all-targets");
+        }
 
         // Explicitly pass -p for all compiler krates -- this will force cargo
         // to also check the tests/benches/examples for these crates, rather
@@ -313,7 +324,12 @@ fn run(self, builder: &Builder<'_>) {
                     $source_type,
                     &[],
                 );
-                cargo.arg("--all-targets");
+
+                // For ./x.py clippy, don't run with --all-targets because
+                // linting tests and benchmarks can produce very noisy results
+                if builder.kind != Kind::Clippy {
+                    cargo.arg("--all-targets");
+                }
 
                 // Enable internal lints for clippy and rustdoc
                 // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`