File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -851,8 +851,8 @@ impl<'a> Builder<'a> {
851851 }
852852 rustflags. env ( "RUSTFLAGS_BOOTSTRAP" ) ;
853853 if cmd == "clippy" {
854- // clippy overwrites any sysroot we pass on the command line .
855- // Tell it to use the appropriate sysroot instead.
854+ // clippy overwrites sysroot if we pass it to cargo .
855+ // Pass it directly to clippy instead.
856856 // NOTE: this can't be fixed in clippy because we explicitly don't set `RUSTC`,
857857 // so it has no way of knowing the sysroot.
858858 rustflags. arg ( "--sysroot" ) ;
@@ -867,8 +867,7 @@ impl<'a> Builder<'a> {
867867 // Explicitly does *not* set `--cfg=bootstrap`, since we're using a nightly clippy.
868868 let host_version = Command :: new ( "rustc" ) . arg ( "--version" ) . output ( ) . map_err ( |_| ( ) ) ;
869869 let output = host_version. and_then ( |output| {
870- if output. status . success ( )
871- {
870+ if output. status . success ( ) {
872871 Ok ( output)
873872 } else {
874873 Err ( ( ) )
Original file line number Diff line number Diff line change @@ -16,12 +16,23 @@ pub struct Std {
1616
1717/// Returns args for the subcommand itself (not for cargo)
1818fn args ( builder : & Builder < ' _ > ) -> Vec < String > {
19+ fn strings < ' a > ( arr : & ' a [ & str ] ) -> impl Iterator < Item = String > + ' a {
20+ arr. iter ( ) . copied ( ) . map ( String :: from)
21+ }
22+
1923 if let Subcommand :: Clippy { fix, .. } = builder. config . cmd {
20- let mut args = vec ! [ "--" . to_owned ( ) , "--cap-lints" . to_owned ( ) , "warn" . to_owned ( ) ] ;
24+ let mut args = vec ! [ ] ;
2125 if fix {
22- args. insert ( 0 , "--fix" . to_owned ( ) ) ;
23- args. insert ( 0 , "-Zunstable-options" . to_owned ( ) ) ;
26+ #[ rustfmt:: skip]
27+ args. extend ( strings ( & [
28+ "--fix" , "-Zunstable-options" ,
29+ // FIXME: currently, `--fix` gives an error while checking tests for libtest,
30+ // possibly because libtest is not yet built in the sysroot.
31+ // As a workaround, avoid checking tests and benches when passed --fix.
32+ "--lib" , "--bins" , "--examples" ,
33+ ] ) ) ;
2434 }
35+ args. extend ( strings ( & [ "--" , "--cap-lints" , "warn" ] ) ) ;
2536 args
2637 } else {
2738 vec ! [ ]
You can’t perform that action at this time.
0 commit comments