@@ -516,45 +516,37 @@ impl Step for Clippy {
516516 let host = self . host ;
517517 let compiler = builder. compiler ( stage, host) ;
518518
519- let clippy = builder. ensure ( tool:: Clippy {
519+ let clippy = builder
520+ . ensure ( tool:: Clippy { compiler, target : self . host , extra_features : Vec :: new ( ) } )
521+ . expect ( "in-tree tool" ) ;
522+ let mut cargo = tool:: prepare_tool_cargo (
523+ builder,
520524 compiler,
521- target : self . host ,
522- extra_features : Vec :: new ( ) ,
523- } ) ;
524- if let Some ( clippy) = clippy {
525- let mut cargo = tool:: prepare_tool_cargo (
526- builder,
527- compiler,
528- Mode :: ToolRustc ,
529- host,
530- "test" ,
531- "src/tools/clippy" ,
532- SourceType :: InTree ,
533- & [ ] ,
534- ) ;
525+ Mode :: ToolRustc ,
526+ host,
527+ "test" ,
528+ "src/tools/clippy" ,
529+ SourceType :: InTree ,
530+ & [ ] ,
531+ ) ;
535532
536- // clippy tests need to know about the stage sysroot
537- cargo. env ( "SYSROOT" , builder. sysroot ( compiler) ) ;
538- cargo. env ( "RUSTC_TEST_SUITE" , builder. rustc ( compiler) ) ;
539- cargo. env ( "RUSTC_LIB_PATH" , builder. rustc_libdir ( compiler) ) ;
540- let host_libs = builder. stage_out ( compiler, Mode :: ToolRustc ) . join ( builder. cargo_dir ( ) ) ;
541- let target_libs = builder
542- . stage_out ( compiler, Mode :: ToolRustc )
543- . join ( & self . host )
544- . join ( builder. cargo_dir ( ) ) ;
545- cargo. env ( "HOST_LIBS" , host_libs) ;
546- cargo. env ( "TARGET_LIBS" , target_libs) ;
547- // clippy tests need to find the driver
548- cargo. env ( "CLIPPY_DRIVER_PATH" , clippy) ;
533+ // clippy tests need to know about the stage sysroot
534+ cargo. env ( "SYSROOT" , builder. sysroot ( compiler) ) ;
535+ cargo. env ( "RUSTC_TEST_SUITE" , builder. rustc ( compiler) ) ;
536+ cargo. env ( "RUSTC_LIB_PATH" , builder. rustc_libdir ( compiler) ) ;
537+ let host_libs = builder. stage_out ( compiler, Mode :: ToolRustc ) . join ( builder. cargo_dir ( ) ) ;
538+ let target_libs =
539+ builder. stage_out ( compiler, Mode :: ToolRustc ) . join ( & self . host ) . join ( builder. cargo_dir ( ) ) ;
540+ cargo. env ( "HOST_LIBS" , host_libs) ;
541+ cargo. env ( "TARGET_LIBS" , target_libs) ;
542+ // clippy tests need to find the driver
543+ cargo. env ( "CLIPPY_DRIVER_PATH" , clippy) ;
549544
550- cargo. arg ( "--" ) . args ( builder. config . cmd . test_args ( ) ) ;
545+ cargo. arg ( "--" ) . args ( builder. config . cmd . test_args ( ) ) ;
551546
552- builder. add_rustc_lib_path ( compiler, & mut cargo) ;
547+ builder. add_rustc_lib_path ( compiler, & mut cargo) ;
553548
554- try_run ( builder, & mut cargo. into ( ) ) ;
555- } else {
556- eprintln ! ( "failed to test clippy: could not build" ) ;
557- }
549+ try_run ( builder, & mut cargo. into ( ) ) ;
558550 }
559551}
560552
0 commit comments