Skip to content

Commit 5e31280

Browse files
committed
refactor(rustup-mode)!: remove redundant ExitCode in self_update()'s callback
1 parent 4149df6 commit 5e31280

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/cli/common.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,14 @@ pub(crate) async fn update_all_channels(
308308
.collect();
309309
show_channel_updates(cfg, t)?;
310310
}
311-
Ok(utils::ExitCode(0))
311+
Ok(())
312312
};
313313

314314
if do_self_update {
315315
self_update(show_channel_updates, cfg.process).await
316316
} else {
317-
show_channel_updates()
317+
show_channel_updates()?;
318+
Ok(utils::ExitCode(0))
318319
}
319320
}
320321

@@ -358,7 +359,7 @@ pub(crate) fn self_update_permitted(explicit: bool) -> Result<SelfUpdatePermissi
358359
/// Performs all of a self-update: check policy, download, apply and exit.
359360
pub(crate) async fn self_update<F>(before_restart: F, process: &Process) -> Result<utils::ExitCode>
360361
where
361-
F: FnOnce() -> Result<utils::ExitCode>,
362+
F: FnOnce() -> Result<()>,
362363
{
363364
match self_update_permitted(false)? {
364365
SelfUpdatePermission::HardFail => {

src/cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ async fn update(cfg: &mut Cfg<'_>, opts: UpdateOpts) -> Result<utils::ExitCode>
862862
}
863863
}
864864
if self_update {
865-
common::self_update(|| Ok(utils::ExitCode(0)), cfg.process).await?;
865+
common::self_update(|| Ok(()), cfg.process).await?;
866866
}
867867
} else {
868868
common::update_all_channels(cfg, self_update, opts.force).await?;

0 commit comments

Comments
 (0)