about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-09-05 10:32:23 +0200
committerGitHub <noreply@github.com>2021-09-05 10:32:23 +0200
commit5fdc8eb2e8ea8b54fbd83b291ab0db8d0a573a82 (patch)
tree9a76575df0292e608ef33cec7d119779ee552c8b
parent22dd6a4e30c9f4ddcafa3e2a536658bd15dc1a8d (diff)
parent5538be5d80c0ec92918f4a57c5a94e9cb5287164 (diff)
downloadrust-5fdc8eb2e8ea8b54fbd83b291ab0db8d0a573a82.tar.gz
rust-5fdc8eb2e8ea8b54fbd83b291ab0db8d0a573a82.zip
Rollup merge of #88511 - matthiaskrgr:xpyclippydefaulttarget, r=jyn514
x.py clippy: don't run with --all-targets by default

this caused a lot of noise because benchmarks and tests were also checked

before:
`./x.py clippy |& wc -l`
`74026`

with change:
`./x.py clippy |& wc -l`
`43269`

Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/x.2Epy.20check.20default.20targets

r?  `@jyn514` or `@Mark-Simulacrum`
-rw-r--r--src/bootstrap/check.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 4eb335979b9..f5fad4b4136 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -107,6 +107,11 @@ impl Step for Std {
             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 @@ impl Step for Std {
             target,
             cargo_subcommand(builder.kind),
         );
+
         cargo.arg("--all-targets");
         std_cargo(builder, target, compiler.stage, &mut cargo);
 
@@ -192,7 +198,12 @@ impl Step for Rustc {
             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 @@ macro_rules! tool_check_step {
                     $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)]`