@@ -1024,24 +1024,15 @@ macro_rules! tool_extended {
1024
1024
1025
1025
impl Step for $name {
1026
1026
type Output = PathBuf ;
1027
- const DEFAULT : bool = true ; // Overwritten below
1027
+ const DEFAULT : bool = true ; // Overridden by `should_run_tool_build_step`
1028
1028
const ONLY_HOSTS : bool = true ;
1029
1029
1030
1030
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,
1045
1036
)
1046
1037
}
1047
1038
@@ -1067,6 +1058,30 @@ macro_rules! tool_extended {
1067
1058
}
1068
1059
}
1069
1060
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
+
1070
1085
fn run_tool_build_step (
1071
1086
builder : & Builder < ' _ > ,
1072
1087
compiler : Compiler ,
0 commit comments