@@ -1966,8 +1966,6 @@ fn add_env(
1966
1966
target : TargetSelection ,
1967
1967
built_tools : & HashSet < & ' static str > ,
1968
1968
) {
1969
- // envs for wix should be always defined, even if not used
1970
- // FIXME: is they affect ccache?
1971
1969
let mut parts = builder. version . split ( '.' ) ;
1972
1970
cmd. env ( "CFG_RELEASE_INFO" , builder. rust_version ( ) )
1973
1971
. env ( "CFG_RELEASE_NUM" , & builder. version )
@@ -1989,26 +1987,14 @@ fn add_env(
1989
1987
cmd. env ( "CFG_MINGW" , "0" ) . env ( "CFG_ABI" , "MSVC" ) ;
1990
1988
}
1991
1989
1992
- if built_tools. contains ( "rustfmt" ) {
1993
- cmd. env ( "CFG_RUSTFMT" , "1" ) ;
1994
- } else {
1995
- cmd. env ( "CFG_RUSTFMT" , "0" ) ;
1996
- }
1997
- if built_tools. contains ( "clippy" ) {
1998
- cmd. env ( "CFG_CLIPPY" , "1" ) ;
1999
- } else {
2000
- cmd. env ( "CFG_CLIPPY" , "0" ) ;
2001
- }
2002
- if built_tools. contains ( "miri" ) {
2003
- cmd. env ( "CFG_MIRI" , "1" ) ;
2004
- } else {
2005
- cmd. env ( "CFG_MIRI" , "0" ) ;
2006
- }
2007
- if built_tools. contains ( "rust-analyzer" ) {
2008
- cmd. env ( "CFG_RA" , "1" ) ;
2009
- } else {
2010
- cmd. env ( "CFG_RA" , "0" ) ;
2011
- }
1990
+ // ensure these variables are defined
1991
+ let mut define_optional_tool = |tool_name : & str , env_name : & str | {
1992
+ cmd. env ( env_name, if built_tools. contains ( tool_name) { "1" } else { "0" } ) ;
1993
+ } ;
1994
+ define_optional_tool ( "rustfmt" , "CFG_RUSTFMT" ) ;
1995
+ define_optional_tool ( "clippy" , "CFG_CLIPPY" ) ;
1996
+ define_optional_tool ( "miri" , "CFG_MIRI" ) ;
1997
+ define_optional_tool ( "rust-analyzer" , "CFG_RA" ) ;
2012
1998
}
2013
1999
2014
2000
fn install_llvm_file (
0 commit comments