File tree 2 files changed +17
-7
lines changed
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> {
851
851
}
852
852
rustflags. env ( "RUSTFLAGS_BOOTSTRAP" ) ;
853
853
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.
856
856
// NOTE: this can't be fixed in clippy because we explicitly don't set `RUSTC`,
857
857
// so it has no way of knowing the sysroot.
858
858
rustflags. arg ( "--sysroot" ) ;
@@ -867,8 +867,7 @@ impl<'a> Builder<'a> {
867
867
// Explicitly does *not* set `--cfg=bootstrap`, since we're using a nightly clippy.
868
868
let host_version = Command :: new ( "rustc" ) . arg ( "--version" ) . output ( ) . map_err ( |_| ( ) ) ;
869
869
let output = host_version. and_then ( |output| {
870
- if output. status . success ( )
871
- {
870
+ if output. status . success ( ) {
872
871
Ok ( output)
873
872
} else {
874
873
Err ( ( ) )
Original file line number Diff line number Diff line change @@ -16,12 +16,23 @@ pub struct Std {
16
16
17
17
/// Returns args for the subcommand itself (not for cargo)
18
18
fn 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
+
19
23
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 ! [ ] ;
21
25
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
+ ] ) ) ;
24
34
}
35
+ args. extend ( strings ( & [ "--" , "--cap-lints" , "warn" ] ) ) ;
25
36
args
26
37
} else {
27
38
vec ! [ ]
You can’t perform that action at this time.
0 commit comments