@@ -50,7 +50,6 @@ use same_file::Handle;
5050use serde:: { Deserialize , Serialize } ;
5151use tracing:: { error, info, trace, warn} ;
5252
53- use crate :: dist:: download:: DownloadCfg ;
5453use crate :: {
5554 DUP_TOOLS , TOOLS ,
5655 cli:: {
@@ -59,7 +58,7 @@ use crate::{
5958 markdown:: md,
6059 } ,
6160 config:: Cfg ,
62- dist:: { PartialToolchainDesc , Profile , TargetTriple , ToolchainDesc } ,
61+ dist:: { PartialToolchainDesc , Profile , TargetTriple , ToolchainDesc , download :: DownloadCfg } ,
6362 download:: download_file,
6463 errors:: RustupError ,
6564 install:: UpdateStatus ,
@@ -68,7 +67,7 @@ use crate::{
6867 DistributableToolchain , MaybeOfficialToolchainName , ResolvableToolchainName , Toolchain ,
6968 ToolchainName ,
7069 } ,
71- utils,
70+ utils:: { self , ExitCode } ,
7271} ;
7372
7473#[ cfg( unix) ]
@@ -523,9 +522,9 @@ pub(crate) async fn install(
523522 no_prompt : bool ,
524523 mut opts : InstallOpts < ' _ > ,
525524 cfg : & mut Cfg < ' _ > ,
526- ) -> Result < utils :: ExitCode > {
525+ ) -> Result < ExitCode > {
527526 #[ cfg_attr( not( unix) , allow( unused_mut) ) ]
528- let mut exit_code = utils :: ExitCode ( 0 ) ;
527+ let mut exit_code = ExitCode ( 0 ) ;
529528
530529 opts. validate ( cfg. process ) . map_err ( |e| {
531530 anyhow ! (
@@ -565,7 +564,7 @@ pub(crate) async fn install(
565564 match common:: confirm_advanced ( customized_install, cfg. process ) ? {
566565 Confirm :: No => {
567566 info ! ( "aborting installation" ) ;
568- return Ok ( utils :: ExitCode ( 0 ) ) ;
567+ return Ok ( ExitCode ( 0 ) ) ;
569568 }
570569 Confirm :: Yes => {
571570 break ;
@@ -591,7 +590,7 @@ pub(crate) async fn install(
591590 windows:: ensure_prompt ( cfg. process ) ?;
592591 }
593592
594- return Ok ( utils :: ExitCode ( 1 ) ) ;
593+ return Ok ( ExitCode ( 1 ) ) ;
595594 }
596595
597596 let cargo_home = canonical_cargo_home ( cfg. process ) ?;
@@ -983,11 +982,11 @@ pub(crate) fn uninstall(
983982 no_prompt : bool ,
984983 no_modify_path : bool ,
985984 process : & Process ,
986- ) -> Result < utils :: ExitCode > {
985+ ) -> Result < ExitCode > {
987986 if cfg ! ( feature = "no-self-update" ) {
988987 error ! ( "self-uninstall is disabled for this build of rustup" ) ;
989988 error ! ( "you should probably use your system package manager to uninstall rustup" ) ;
990- return Ok ( utils :: ExitCode ( 1 ) ) ;
989+ return Ok ( ExitCode ( 1 ) ) ;
991990 }
992991
993992 let cargo_home = process. cargo_home ( ) ?;
@@ -1009,7 +1008,7 @@ pub(crate) fn uninstall(
10091008 md ( & mut process. stdout ( ) , msg) ;
10101009 if !common:: confirm ( "\n Continue? (y/N)" , false , process) ? {
10111010 info ! ( "aborting uninstallation" ) ;
1012- return Ok ( utils :: ExitCode ( 0 ) ) ;
1011+ return Ok ( ExitCode ( 0 ) ) ;
10131012 }
10141013 }
10151014
@@ -1086,7 +1085,7 @@ pub(crate) fn uninstall(
10861085
10871086 info ! ( "rustup is uninstalled" ) ;
10881087
1089- Ok ( utils :: ExitCode ( 0 ) )
1088+ Ok ( ExitCode ( 0 ) )
10901089}
10911090
10921091#[ derive( Clone , Copy , Debug ) ]
@@ -1127,14 +1126,14 @@ pub(crate) fn self_update_permitted(explicit: bool) -> Result<SelfUpdatePermissi
11271126}
11281127
11291128/// Performs all of a self-update: check policy, download, apply and exit.
1130- pub ( crate ) async fn self_update ( dl_cfg : & DownloadCfg < ' _ > ) -> Result < utils :: ExitCode > {
1129+ pub ( crate ) async fn self_update ( dl_cfg : & DownloadCfg < ' _ > ) -> Result < ExitCode > {
11311130 match self_update_permitted ( false ) ? {
11321131 SelfUpdatePermission :: HardFail => {
11331132 error ! ( "Unable to self-update. STOP" ) ;
1134- return Ok ( utils :: ExitCode ( 1 ) ) ;
1133+ return Ok ( ExitCode ( 1 ) ) ;
11351134 }
11361135 #[ cfg( not( windows) ) ]
1137- SelfUpdatePermission :: Skip => return Ok ( utils :: ExitCode ( 0 ) ) ,
1136+ SelfUpdatePermission :: Skip => return Ok ( ExitCode ( 0 ) ) ,
11381137 SelfUpdatePermission :: Permit => { }
11391138 }
11401139
@@ -1147,7 +1146,7 @@ pub(crate) async fn self_update(dl_cfg: &DownloadCfg<'_>) -> Result<utils::ExitC
11471146 install_proxies ( dl_cfg. process ) ?;
11481147 }
11491148
1150- Ok ( utils :: ExitCode ( 0 ) )
1149+ Ok ( ExitCode ( 0 ) )
11511150}
11521151
11531152/// Self update downloads rustup-init to `CARGO_HOME`/bin/rustup-init
@@ -1165,7 +1164,7 @@ pub(crate) async fn self_update(dl_cfg: &DownloadCfg<'_>) -> Result<utils::ExitC
11651164/// (and on windows this process will not be running to do it),
11661165/// rustup-init is stored in `CARGO_HOME`/bin, and then deleted next
11671166/// time rustup runs.
1168- pub ( crate ) async fn update ( cfg : & Cfg < ' _ > ) -> Result < utils :: ExitCode > {
1167+ pub ( crate ) async fn update ( cfg : & Cfg < ' _ > ) -> Result < ExitCode > {
11691168 common:: warn_if_host_is_emulated ( cfg. process ) ;
11701169
11711170 use SelfUpdatePermission :: * ;
@@ -1179,12 +1178,12 @@ pub(crate) async fn update(cfg: &Cfg<'_>) -> Result<utils::ExitCode> {
11791178 // TODO: Detect which package manager and be more useful.
11801179 error ! ( "self-update is disabled for this build of rustup" ) ;
11811180 error ! ( "you should probably use your system package manager to update rustup" ) ;
1182- return Ok ( utils :: ExitCode ( 1 ) ) ;
1181+ return Ok ( ExitCode ( 1 ) ) ;
11831182 }
11841183 #[ cfg( not( windows) ) ]
11851184 Skip => {
11861185 info ! ( "Skipping self-update at this time" ) ;
1187- return Ok ( utils :: ExitCode ( 0 ) ) ;
1186+ return Ok ( ExitCode ( 0 ) ) ;
11881187 }
11891188 Permit => { }
11901189 }
@@ -1193,7 +1192,7 @@ pub(crate) async fn update(cfg: &Cfg<'_>) -> Result<utils::ExitCode> {
11931192 Some ( setup_path) => {
11941193 let Some ( version) = get_and_parse_new_rustup_version ( & setup_path) else {
11951194 error ! ( "failed to get rustup version" ) ;
1196- return Ok ( utils :: ExitCode ( 1 ) ) ;
1195+ return Ok ( ExitCode ( 1 ) ) ;
11971196 } ;
11981197
11991198 let _ = common:: show_channel_update (
@@ -1214,7 +1213,7 @@ pub(crate) async fn update(cfg: &Cfg<'_>) -> Result<utils::ExitCode> {
12141213 }
12151214 }
12161215
1217- Ok ( utils :: ExitCode ( 0 ) )
1216+ Ok ( ExitCode ( 0 ) )
12181217}
12191218
12201219fn get_and_parse_new_rustup_version ( path : & Path ) -> Option < String > {
0 commit comments