@@ -333,6 +333,12 @@ These components can be acquired through a Visual Studio installer.
333
333
334
334
static UPDATE_ROOT : & str = "https://static.rust-lang.org/rustup" ;
335
335
336
+ fn update_root ( ) -> String {
337
+ process ( )
338
+ . var ( "RUSTUP_UPDATE_ROOT" )
339
+ . unwrap_or_else ( |_| String :: from ( UPDATE_ROOT ) )
340
+ }
341
+
336
342
/// `CARGO_HOME` suitable for display, possibly with $HOME
337
343
/// substituted for the directory prefix
338
344
fn canonical_cargo_home ( ) -> Result < Cow < ' static , str > > {
@@ -1178,9 +1184,7 @@ pub(crate) fn prepare_update() -> Result<Option<PathBuf>> {
1178
1184
let triple = dist:: TargetTriple :: from_host ( ) . unwrap_or ( triple) ;
1179
1185
1180
1186
// Get update root.
1181
- let update_root = process ( )
1182
- . var ( "RUSTUP_UPDATE_ROOT" )
1183
- . unwrap_or_else ( |_| String :: from ( UPDATE_ROOT ) ) ;
1187
+ let update_root = update_root ( ) ;
1184
1188
1185
1189
// Get current version
1186
1190
let current_version = env ! ( "CARGO_PKG_VERSION" ) ;
@@ -1211,9 +1215,7 @@ pub(crate) fn prepare_update() -> Result<Option<PathBuf>> {
1211
1215
}
1212
1216
1213
1217
pub ( crate ) fn get_available_rustup_version ( ) -> Result < String > {
1214
- let update_root = process ( )
1215
- . var ( "RUSTUP_UPDATE_ROOT" )
1216
- . unwrap_or_else ( |_| String :: from ( UPDATE_ROOT ) ) ;
1218
+ let update_root = update_root ( ) ;
1217
1219
let tempdir = tempfile:: Builder :: new ( )
1218
1220
. prefix ( "rustup-update" )
1219
1221
. tempdir ( )
0 commit comments