@@ -946,13 +946,7 @@ async fn update(
946946
947947 common:: warn_if_host_is_emulated ( cfg. process ) ;
948948 let self_update_mode = SelfUpdateMode :: from_cfg ( cfg) ?;
949- // Priority: no-self-update feature > self_update_mode > no-self-update args.
950- // Update only if rustup does **not** have the no-self-update feature,
951- // and auto-self-update is configured to **enable**
952- // and has **no** no-self-update parameter.
953- let self_update = !cfg ! ( feature = "no-self-update" )
954- && self_update_mode == SelfUpdateMode :: Enable
955- && !opts. no_self_update ;
949+ let should_self_update = !opts. no_self_update ;
956950 let force_non_host = opts. force_non_host ;
957951 cfg. profile_override = opts. profile ;
958952
@@ -1014,33 +1008,22 @@ async fn update(
10141008 cfg. set_default ( Some ( & desc. into ( ) ) ) ?;
10151009 }
10161010 }
1017- if self_update {
1018- exit_code &= self_update:: self_update ( & dl_cfg) . await ?;
1019- }
1011+ exit_code &=
1012+ self_update:: self_update ( self_update_mode, should_self_update, & dl_cfg) . await ?;
10201013 } else if ensure_active_toolchain {
10211014 let ( toolchain, source) = cfg. ensure_active_toolchain ( force_non_host, true ) . await ?;
10221015 info ! ( "the active toolchain `{toolchain}` has been installed" ) ;
10231016 info ! ( "it's active because: {}" , source. to_reason( ) ) ;
10241017 } else {
10251018 exit_code &= common:: update_all_channels ( cfg, opts. force ) . await ?;
1026- if self_update {
1027- exit_code &= self_update:: self_update ( & dl_cfg) . await ?;
1028- }
1019+ exit_code &=
1020+ self_update:: self_update ( self_update_mode, should_self_update, & dl_cfg) . await ?;
10291021
10301022 info ! ( "cleaning up downloads & tmp directories" ) ;
10311023 utils:: delete_dir_contents_following_links ( & cfg. download_dir ) ;
10321024 cfg. tmp_cx . clean ( ) ;
10331025 }
10341026
1035- if !cfg ! ( feature = "no-self-update" ) && self_update_mode == SelfUpdateMode :: CheckOnly {
1036- check_rustup_update ( & dl_cfg) . await ?;
1037- }
1038-
1039- if cfg ! ( feature = "no-self-update" ) {
1040- info ! ( "self-update is disabled for this build of rustup" ) ;
1041- info ! ( "any updates to rustup will need to be fetched with your system package manager" )
1042- }
1043-
10441027 Ok ( exit_code)
10451028}
10461029
0 commit comments