From 1203d6e0c3d37465503e22734a7b1dd537a0723d Mon Sep 17 00:00:00 2001 From: CrazyMerlyn Date: Tue, 16 May 2017 00:34:50 +0530 Subject: [PATCH] Exit successfully on "update not yet available" --- src/rustup-dist/src/dist.rs | 3 +++ src/rustup/toolchain.rs | 2 +- tests/cli-v2.rs | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rustup-dist/src/dist.rs b/src/rustup-dist/src/dist.rs index b7fde7d4ef..e74fd48a97 100644 --- a/src/rustup-dist/src/dist.rs +++ b/src/rustup-dist/src/dist.rs @@ -666,6 +666,9 @@ pub fn update_from_dist_<'a>(download: DownloadCfg<'a>, // Proceed to try v1 as a fallback (download.notify_handler)(Notification::DownloadingLegacyManifest); } + Err(Error(ErrorKind::ChecksumFailed { .. }, _)) => { + return Ok(None) + } Err(e) => return Err(e), } diff --git a/src/rustup/toolchain.rs b/src/rustup/toolchain.rs index a37e711d31..580c2a6963 100644 --- a/src/rustup/toolchain.rs +++ b/src/rustup/toolchain.rs @@ -123,7 +123,7 @@ impl<'a> Toolchain<'a> { (true, false) => UpdateStatus::Installed, (true, true) => UpdateStatus::Updated, (false, true) => UpdateStatus::Unchanged, - (false, false) => unreachable!(), + (false, false) => UpdateStatus::Unchanged, }; Ok(status) diff --git a/tests/cli-v2.rs b/tests/cli-v2.rs index f55674a6dc..dd6da4228d 100644 --- a/tests/cli-v2.rs +++ b/tests/cli-v2.rs @@ -198,8 +198,7 @@ fn bad_sha_on_manifest() { sha_bytes[..10].clone_from_slice(b"aaaaaaaaaa"); let sha_str = String::from_utf8(sha_bytes).unwrap(); rustup_utils::raw::write_file(&sha_file, &sha_str).unwrap(); - expect_err(config, &["rustup", "default", "nightly"], - "checksum failed"); + expect_ok(config, &["rustup", "default", "nightly"]); }); }