@@ -291,24 +291,20 @@ pub(crate) async fn update_all_channels(
291
291
info ! ( "no updatable toolchains installed" ) ;
292
292
}
293
293
294
- let show_channel_updates = || {
295
- if !toolchains. is_empty ( ) {
296
- writeln ! ( cfg. process. stdout( ) . lock( ) ) ?;
297
-
298
- let t = toolchains
299
- . into_iter ( )
300
- . map ( |( p, s) | ( PackageUpdate :: Toolchain ( p) , s) )
301
- . collect ( ) ;
302
- show_channel_updates ( cfg, t) ?;
303
- }
304
- Ok ( ( ) )
305
- } ;
294
+ if !toolchains. is_empty ( ) {
295
+ writeln ! ( cfg. process. stdout( ) . lock( ) ) ?;
296
+
297
+ let t = toolchains
298
+ . into_iter ( )
299
+ . map ( |( p, s) | ( PackageUpdate :: Toolchain ( p) , s) )
300
+ . collect ( ) ;
301
+ show_channel_updates ( cfg, t) ?;
302
+ }
306
303
307
304
if do_self_update {
308
- exit_code &= self_update ( show_channel_updates, cfg. process ) . await ?;
309
- } else {
310
- show_channel_updates ( ) ?;
305
+ exit_code &= self_update ( cfg. process ) . await ?;
311
306
}
307
+
312
308
Ok ( exit_code)
313
309
}
314
310
@@ -350,10 +346,7 @@ pub(crate) fn self_update_permitted(explicit: bool) -> Result<SelfUpdatePermissi
350
346
}
351
347
352
348
/// Performs all of a self-update: check policy, download, apply and exit.
353
- pub ( crate ) async fn self_update < F > ( before_restart : F , process : & Process ) -> Result < utils:: ExitCode >
354
- where
355
- F : FnOnce ( ) -> Result < ( ) > ,
356
- {
349
+ pub ( crate ) async fn self_update ( process : & Process ) -> Result < utils:: ExitCode > {
357
350
match self_update_permitted ( false ) ? {
358
351
SelfUpdatePermission :: HardFail => {
359
352
error ! ( "Unable to self-update. STOP" ) ;
@@ -366,8 +359,6 @@ where
366
359
367
360
let setup_path = self_update:: prepare_update ( process) . await ?;
368
361
369
- before_restart ( ) ?;
370
-
371
362
if let Some ( setup_path) = & setup_path {
372
363
return self_update:: run_update ( setup_path) ;
373
364
} else {
0 commit comments