@@ -107,6 +107,11 @@ impl Step for Std {
107107 add_to_sysroot ( & builder, & libdir, & hostdir, & libstd_stamp ( builder, compiler, target) ) ;
108108 }
109109
110+ // don't run on std twice with x.py clippy
111+ if builder. kind == Kind :: Clippy {
112+ return ;
113+ }
114+
110115 // Then run cargo again, once we've put the rmeta files for the library
111116 // crates into the sysroot. This is needed because e.g., core's tests
112117 // depend on `libtest` -- Cargo presumes it will exist, but it doesn't
@@ -120,6 +125,7 @@ impl Step for Std {
120125 target,
121126 cargo_subcommand ( builder. kind ) ,
122127 ) ;
128+
123129 cargo. arg ( "--all-targets" ) ;
124130 std_cargo ( builder, target, compiler. stage , & mut cargo) ;
125131
@@ -192,7 +198,12 @@ impl Step for Rustc {
192198 cargo_subcommand ( builder. kind ) ,
193199 ) ;
194200 rustc_cargo ( builder, & mut cargo, target) ;
195- cargo. arg ( "--all-targets" ) ;
201+
202+ // For ./x.py clippy, don't run with --all-targets because
203+ // linting tests and benchmarks can produce very noisy results
204+ if builder. kind != Kind :: Clippy {
205+ cargo. arg ( "--all-targets" ) ;
206+ }
196207
197208 // Explicitly pass -p for all compiler krates -- this will force cargo
198209 // to also check the tests/benches/examples for these crates, rather
@@ -313,7 +324,12 @@ macro_rules! tool_check_step {
313324 $source_type,
314325 & [ ] ,
315326 ) ;
316- cargo. arg( "--all-targets" ) ;
327+
328+ // For ./x.py clippy, don't run with --all-targets because
329+ // linting tests and benchmarks can produce very noisy results
330+ if builder. kind != Kind :: Clippy {
331+ cargo. arg( "--all-targets" ) ;
332+ }
317333
318334 // Enable internal lints for clippy and rustdoc
319335 // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
0 commit comments