@@ -595,7 +595,7 @@ pub async fn main() -> Result<utils::ExitCode> {
595
595
596
596
match subcmd {
597
597
RustupSubcmd :: DumpTestament => common:: dump_testament ( ) ,
598
- RustupSubcmd :: Install { opts } => update ( cfg, opts) ,
598
+ RustupSubcmd :: Install { opts } => update ( cfg, opts) . await ,
599
599
RustupSubcmd :: Uninstall { opts } => toolchain_remove ( cfg, opts) ,
600
600
RustupSubcmd :: Show { verbose, subcmd } => handle_epipe ( match subcmd {
601
601
None => show ( cfg, verbose) ,
@@ -611,18 +611,21 @@ pub async fn main() -> Result<utils::ExitCode> {
611
611
no_self_update,
612
612
force,
613
613
force_non_host,
614
- } => update (
615
- cfg,
616
- UpdateOpts {
617
- toolchain,
618
- no_self_update,
619
- force,
620
- force_non_host,
621
- ..UpdateOpts :: default ( )
622
- } ,
623
- ) ,
614
+ } => {
615
+ update (
616
+ cfg,
617
+ UpdateOpts {
618
+ toolchain,
619
+ no_self_update,
620
+ force,
621
+ force_non_host,
622
+ ..UpdateOpts :: default ( )
623
+ } ,
624
+ )
625
+ . await
626
+ }
624
627
RustupSubcmd :: Toolchain { subcmd } => match subcmd {
625
- ToolchainSubcmd :: Install { opts } => update ( cfg, opts) ,
628
+ ToolchainSubcmd :: Install { opts } => update ( cfg, opts) . await ,
626
629
ToolchainSubcmd :: List { verbose } => {
627
630
handle_epipe ( common:: list_toolchains ( cfg, verbose) )
628
631
}
@@ -791,7 +794,7 @@ async fn check_updates(cfg: &Cfg) -> Result<utils::ExitCode> {
791
794
Ok ( utils:: ExitCode ( 0 ) )
792
795
}
793
796
794
- fn update ( cfg : & mut Cfg , opts : UpdateOpts ) -> Result < utils:: ExitCode > {
797
+ async fn update ( cfg : & mut Cfg , opts : UpdateOpts ) -> Result < utils:: ExitCode > {
795
798
common:: warn_if_host_is_emulated ( ) ;
796
799
let self_update_mode = cfg. get_self_update_mode ( ) ?;
797
800
// Priority: no-self-update feature > self_update_mode > no-self-update args.
@@ -839,24 +842,20 @@ fn update(cfg: &mut Cfg, opts: UpdateOpts) -> Result<utils::ExitCode> {
839
842
cfg,
840
843
desc. clone ( ) ,
841
844
) {
842
- Ok ( mut d) => utils:: run_future ( d. update_extra (
843
- & components,
844
- & targets,
845
- profile,
846
- force,
847
- allow_downgrade,
848
- ) ) ?,
845
+ Ok ( mut d) => {
846
+ d. update_extra ( & components, & targets, profile, force, allow_downgrade)
847
+ . await ?
848
+ }
849
849
Err ( RustupError :: ToolchainNotInstalled ( _) ) => {
850
- utils:: run_future (
851
- crate :: toolchain:: distributable:: DistributableToolchain :: install (
852
- cfg,
853
- & desc,
854
- & components,
855
- & targets,
856
- profile,
857
- force,
858
- ) ,
859
- ) ?
850
+ crate :: toolchain:: distributable:: DistributableToolchain :: install (
851
+ cfg,
852
+ & desc,
853
+ & components,
854
+ & targets,
855
+ profile,
856
+ force,
857
+ )
858
+ . await ?
860
859
. 0
861
860
}
862
861
Err ( e) => Err ( e) ?,
@@ -873,17 +872,17 @@ fn update(cfg: &mut Cfg, opts: UpdateOpts) -> Result<utils::ExitCode> {
873
872
}
874
873
}
875
874
if self_update {
876
- utils :: run_future ( common:: self_update ( || Ok ( utils:: ExitCode ( 0 ) ) ) ) ?;
875
+ common:: self_update ( || Ok ( utils:: ExitCode ( 0 ) ) ) . await ?;
877
876
}
878
877
} else {
879
- utils :: run_future ( common:: update_all_channels ( cfg, self_update, opts. force ) ) ?;
878
+ common:: update_all_channels ( cfg, self_update, opts. force ) . await ?;
880
879
info ! ( "cleaning up downloads & tmp directories" ) ;
881
880
utils:: delete_dir_contents_following_links ( & cfg. download_dir ) ;
882
881
cfg. tmp_cx . clean ( ) ;
883
882
}
884
883
885
884
if !self_update:: NEVER_SELF_UPDATE && self_update_mode == SelfUpdateMode :: CheckOnly {
886
- utils :: run_future ( check_rustup_update ( ) ) ?;
885
+ check_rustup_update ( ) . await ?;
887
886
}
888
887
889
888
if self_update:: NEVER_SELF_UPDATE {
0 commit comments