@@ -1024,24 +1024,15 @@ macro_rules! tool_extended {
10241024
10251025 impl Step for $name {
10261026 type Output = PathBuf ;
1027- const DEFAULT : bool = true ; // Overwritten below
1027+ const DEFAULT : bool = true ; // Overridden by `should_run_tool_build_step`
10281028 const ONLY_HOSTS : bool = true ;
10291029
10301030 fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
1031- let builder = run. builder;
1032- run. path( $path) . default_condition(
1033- builder. config. extended
1034- && builder. config. tools. as_ref( ) . map_or(
1035- // By default, on nightly/dev enable all tools, else only
1036- // build stable tools.
1037- $stable || builder. build. unstable_features( ) ,
1038- // If `tools` is set, search list for this tool.
1039- |tools| {
1040- tools. iter( ) . any( |tool| match tool. as_ref( ) {
1041- "clippy" => $tool_name == "clippy-driver" ,
1042- x => $tool_name == x,
1043- } )
1044- } ) ,
1031+ should_run_tool_build_step(
1032+ run,
1033+ $tool_name,
1034+ $path,
1035+ $stable,
10451036 )
10461037 }
10471038
@@ -1067,6 +1058,30 @@ macro_rules! tool_extended {
10671058 }
10681059}
10691060
1061+ fn should_run_tool_build_step < ' a > (
1062+ run : ShouldRun < ' a > ,
1063+ tool_name : & ' static str ,
1064+ path : & ' static str ,
1065+ stable : bool ,
1066+ ) -> ShouldRun < ' a > {
1067+ let builder = run. builder ;
1068+ run. path ( path) . default_condition (
1069+ builder. config . extended
1070+ && builder. config . tools . as_ref ( ) . map_or (
1071+ // By default, on nightly/dev enable all tools, else only
1072+ // build stable tools.
1073+ stable || builder. build . unstable_features ( ) ,
1074+ // If `tools` is set, search list for this tool.
1075+ |tools| {
1076+ tools. iter ( ) . any ( |tool| match tool. as_ref ( ) {
1077+ "clippy" => tool_name == "clippy-driver" ,
1078+ x => tool_name == x,
1079+ } )
1080+ } ,
1081+ ) ,
1082+ )
1083+ }
1084+
10701085fn run_tool_build_step (
10711086 builder : & Builder < ' _ > ,
10721087 compiler : Compiler ,
0 commit comments