@@ -297,24 +297,7 @@ impl<'a> Cfg<'a> {
297
297
. map ( |t| t. resolve ( & default_host_triple) )
298
298
. transpose ( ) ?;
299
299
300
- let dist_root_server = match process. var ( "RUSTUP_DIST_SERVER" ) {
301
- Ok ( s) if !s. is_empty ( ) => {
302
- trace ! ( "`RUSTUP_DIST_SERVER` has been set to `{s}`" ) ;
303
- s
304
- }
305
- _ => {
306
- // For backward compatibility
307
- process
308
- . var ( "RUSTUP_DIST_ROOT" )
309
- . ok ( )
310
- . and_then ( utils:: if_not_empty)
311
- . inspect ( |url| trace ! ( "`RUSTUP_DIST_ROOT` has been set to `{url}`" ) )
312
- . map_or ( Cow :: Borrowed ( dist:: DEFAULT_DIST_ROOT ) , Cow :: Owned )
313
- . as_ref ( )
314
- . trim_end_matches ( "/dist" )
315
- . to_owned ( )
316
- }
317
- } ;
300
+ let dist_root_server = dist_root_server ( process) ;
318
301
319
302
let notify_clone = notify_handler. clone ( ) ;
320
303
let tmp_cx = temp:: Context :: new (
@@ -957,6 +940,27 @@ impl<'a> Cfg<'a> {
957
940
}
958
941
}
959
942
943
+ fn dist_root_server ( process : & Process ) -> String {
944
+ match process. var ( "RUSTUP_DIST_SERVER" ) {
945
+ Ok ( s) if !s. is_empty ( ) => {
946
+ trace ! ( "`RUSTUP_DIST_SERVER` has been set to `{s}`" ) ;
947
+ s
948
+ }
949
+ _ => {
950
+ // For backward compatibility
951
+ process
952
+ . var ( "RUSTUP_DIST_ROOT" )
953
+ . ok ( )
954
+ . and_then ( utils:: if_not_empty)
955
+ . inspect ( |url| trace ! ( "`RUSTUP_DIST_ROOT` has been set to `{url}`" ) )
956
+ . map_or ( Cow :: Borrowed ( dist:: DEFAULT_DIST_ROOT ) , Cow :: Owned )
957
+ . as_ref ( )
958
+ . trim_end_matches ( "/dist" )
959
+ . to_owned ( )
960
+ }
961
+ }
962
+ }
963
+
960
964
impl < ' a > Debug for Cfg < ' a > {
961
965
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
962
966
let Self {
0 commit comments