File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1106,12 +1106,9 @@ pub(crate) fn update(cfg: &Cfg) -> Result<utils::ExitCode> {
1106
1106
1107
1107
match prepare_update ( ) ? {
1108
1108
Some ( setup_path) => {
1109
- let version = match get_new_rustup_version ( & setup_path) {
1110
- Some ( new_version) => parse_new_rustup_version ( new_version) ,
1111
- None => {
1112
- err ! ( "failed to get rustup version" ) ;
1113
- return Ok ( utils:: ExitCode ( 1 ) ) ;
1114
- }
1109
+ let Some ( version) = get_and_parse_new_rustup_version ( & setup_path) else {
1110
+ err ! ( "failed to get rustup version" ) ;
1111
+ return Ok ( utils:: ExitCode ( 1 ) ) ;
1115
1112
} ;
1116
1113
1117
1114
let _ = common:: show_channel_update (
@@ -1135,6 +1132,10 @@ pub(crate) fn update(cfg: &Cfg) -> Result<utils::ExitCode> {
1135
1132
Ok ( utils:: ExitCode ( 0 ) )
1136
1133
}
1137
1134
1135
+ fn get_and_parse_new_rustup_version ( path : & Path ) -> Option < String > {
1136
+ get_new_rustup_version ( path) . map ( parse_new_rustup_version)
1137
+ }
1138
+
1138
1139
fn get_new_rustup_version ( path : & Path ) -> Option < String > {
1139
1140
match Command :: new ( path) . arg ( "--version" ) . output ( ) {
1140
1141
Err ( _) => None ,
You can’t perform that action at this time.
0 commit comments