@@ -504,9 +504,10 @@ fn update_root(process: &Process) -> String {
504
504
/// `CARGO_HOME` suitable for display, possibly with $HOME
505
505
/// substituted for the directory prefix
506
506
fn canonical_cargo_home ( process : & Process ) -> Result < Cow < ' static , str > > {
507
- let path = utils :: cargo_home ( process ) ?;
507
+ let path = process . cargo_home ( ) ?;
508
508
509
- let default_cargo_home = utils:: home_dir ( process)
509
+ let default_cargo_home = process
510
+ . home_dir ( )
510
511
. unwrap_or_else ( || PathBuf :: from ( "." ) )
511
512
. join ( ".cargo" ) ;
512
513
Ok ( if default_cargo_home == path {
@@ -727,7 +728,7 @@ fn check_existence_of_rustc_or_cargo_in_path(no_prompt: bool, process: &Process)
727
728
fn do_pre_install_sanity_checks ( no_prompt : bool , process : & Process ) -> Result < ( ) > {
728
729
let rustc_manifest_path = PathBuf :: from ( "/usr/local/lib/rustlib/manifest-rustc" ) ;
729
730
let uninstaller_path = PathBuf :: from ( "/usr/local/lib/rustlib/uninstall.sh" ) ;
730
- let rustup_sh_path = utils :: home_dir ( process ) . unwrap ( ) . join ( ".rustup" ) ;
731
+ let rustup_sh_path = process . home_dir ( ) . unwrap ( ) . join ( ".rustup" ) ;
731
732
let rustup_sh_version_path = rustup_sh_path. join ( "rustup-version" ) ;
732
733
733
734
let rustc_exists = rustc_manifest_path. exists ( ) && uninstaller_path. exists ( ) ;
@@ -761,7 +762,7 @@ fn do_pre_install_sanity_checks(no_prompt: bool, process: &Process) -> Result<()
761
762
}
762
763
763
764
fn pre_install_msg ( no_modify_path : bool , process : & Process ) -> Result < String > {
764
- let cargo_home = utils :: cargo_home ( process ) ?;
765
+ let cargo_home = process . cargo_home ( ) ?;
765
766
let cargo_home_bin = cargo_home. join ( "bin" ) ;
766
767
let rustup_home = home:: rustup_home ( ) ?;
767
768
@@ -824,7 +825,7 @@ fn current_install_opts(opts: &InstallOpts<'_>, process: &Process) -> String {
824
825
}
825
826
826
827
fn install_bins ( process : & Process ) -> Result < ( ) > {
827
- let bin_path = utils :: cargo_home ( process ) ?. join ( "bin" ) ;
828
+ let bin_path = process . cargo_home ( ) ?. join ( "bin" ) ;
828
829
let this_exe_path = utils:: current_exe ( ) ?;
829
830
let rustup_path = bin_path. join ( format ! ( "rustup{EXE_SUFFIX}" ) ) ;
830
831
@@ -840,7 +841,7 @@ fn install_bins(process: &Process) -> Result<()> {
840
841
}
841
842
842
843
pub ( crate ) fn install_proxies ( process : & Process ) -> Result < ( ) > {
843
- let bin_path = utils :: cargo_home ( process ) ?. join ( "bin" ) ;
844
+ let bin_path = process . cargo_home ( ) ?. join ( "bin" ) ;
844
845
let rustup_path = bin_path. join ( format ! ( "rustup{EXE_SUFFIX}" ) ) ;
845
846
846
847
let rustup = Handle :: from_path ( & rustup_path) ?;
@@ -938,7 +939,8 @@ async fn maybe_install_rust(
938
939
939
940
// If RUSTUP_HOME is not set, make sure it exists
940
941
if process. var_os ( "RUSTUP_HOME" ) . is_none ( ) {
941
- let home = utils:: home_dir ( process)
942
+ let home = process
943
+ . home_dir ( )
942
944
. map ( |p| p. join ( ".rustup" ) )
943
945
. ok_or_else ( || anyhow:: anyhow!( "could not find home dir to put .rustup in" ) ) ?;
944
946
@@ -988,7 +990,7 @@ pub(crate) fn uninstall(no_prompt: bool, process: &Process) -> Result<utils::Exi
988
990
return Ok ( utils:: ExitCode ( 1 ) ) ;
989
991
}
990
992
991
- let cargo_home = utils :: cargo_home ( process ) ?;
993
+ let cargo_home = process . cargo_home ( ) ?;
992
994
993
995
if !cargo_home. join ( format ! ( "bin/rustup{EXE_SUFFIX}" ) ) . exists ( ) {
994
996
return Err ( CLIError :: NotSelfInstalled { p : cargo_home } . into ( ) ) ;
@@ -1178,7 +1180,7 @@ fn parse_new_rustup_version(version: String) -> String {
1178
1180
}
1179
1181
1180
1182
pub ( crate ) async fn prepare_update ( process : & Process ) -> Result < Option < PathBuf > > {
1181
- let cargo_home = utils :: cargo_home ( process ) ?;
1183
+ let cargo_home = process . cargo_home ( ) ?;
1182
1184
let rustup_path = cargo_home. join ( format ! ( "bin{MAIN_SEPARATOR}rustup{EXE_SUFFIX}" ) ) ;
1183
1185
let setup_path = cargo_home. join ( format ! ( "bin{MAIN_SEPARATOR}rustup-init{EXE_SUFFIX}" ) ) ;
1184
1186
@@ -1319,7 +1321,7 @@ pub(crate) async fn check_rustup_update(process: &Process) -> Result<()> {
1319
1321
1320
1322
#[ cfg_attr( feature = "otel" , tracing:: instrument) ]
1321
1323
pub ( crate ) fn cleanup_self_updater ( process : & Process ) -> Result < ( ) > {
1322
- let cargo_home = utils :: cargo_home ( process ) ?;
1324
+ let cargo_home = process . cargo_home ( ) ?;
1323
1325
let setup = cargo_home. join ( format ! ( "bin/rustup-init{EXE_SUFFIX}" ) ) ;
1324
1326
1325
1327
if setup. exists ( ) {
0 commit comments