Skip to content

Commit c40b04f

Browse files
authored
Merge pull request #1719 from dwijnand/merge-errors
Merge utils+dist errors into rustup errors
2 parents 19fcd19 + 961d91d commit c40b04f

25 files changed

+322
-370
lines changed

src/cli/errors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ use rustup::dist::temp;
1111
error_chain! {
1212
links {
1313
Rustup(rustup::Error, rustup::ErrorKind);
14-
Dist(rustup::dist::Error, rustup::dist::ErrorKind);
15-
Utils(rustup::utils::Error, rustup::utils::ErrorKind);
1614
}
1715

1816
foreign_links {

src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn run_command_for_dir<S: AsRef<OsStr>>(
1616
// when and why this is needed.
1717
cmd.stdin(process::Stdio::inherit());
1818

19-
return exec(&mut cmd).chain_err(|| crate::utils::ErrorKind::RunningCommand {
19+
return exec(&mut cmd).chain_err(|| crate::ErrorKind::RunningCommand {
2020
name: OsStr::new(arg0).to_owned(),
2121
});
2222

src/dist/component/components.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::dist::errors::*;
21
use crate::dist::prefix::InstallPrefix;
2+
use crate::errors::*;
33
/// The representation of the installed toolchain and its components.
44
/// `Components` and `DirectoryPackage` are the two sides of the
55
/// installation / uninstallation process.

src/dist/component/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use crate::dist::component::components::*;
66
use crate::dist::component::transaction::*;
77

8-
use crate::dist::errors::*;
98
use crate::dist::temp;
9+
use crate::errors::*;
1010
use crate::utils::utils;
1111

1212
use std::collections::HashSet;

src/dist/component/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
//! FIXME: This uses ensure_dir_exists in some places but rollback
1010
//! does not remove any dirs created by it.
1111
12-
use crate::dist::errors::*;
1312
use crate::dist::notifications::*;
1413
use crate::dist::prefix::InstallPrefix;
1514
use crate::dist::temp;
15+
use crate::errors::*;
1616
use crate::utils::utils;
1717

1818
use std::fs::File;

src/dist/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::manifest::Component;
2-
use crate::dist::errors::*;
2+
use crate::errors::*;
33
use crate::utils::toml_utils::*;
44

55
pub const SUPPORTED_CONFIG_VERSIONS: [&'static str; 1] = ["1"];

src/dist/dist.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::dist::download::DownloadCfg;
2-
use crate::dist::errors::*;
32
use crate::dist::manifest::Component;
43
use crate::dist::manifest::Manifest as ManifestV2;
54
use crate::dist::manifestation::{Changes, Manifestation, UpdateStatus};
65
use crate::dist::notifications::*;
76
use crate::dist::prefix::InstallPrefix;
87
use crate::dist::temp;
8+
use crate::errors::*;
99
use crate::utils::utils;
1010

1111
use std::env;
@@ -563,7 +563,7 @@ pub fn update_from_dist_<'a>(
563563
};
564564
}
565565
Ok(None) => return Ok(None),
566-
Err(Error(ErrorKind::Utils(crate::utils::ErrorKind::DownloadNotExists { .. }), _)) => {
566+
Err(Error(crate::ErrorKind::DownloadNotExists { .. }, _)) => {
567567
// Proceed to try v1 as a fallback
568568
(download.notify_handler)(Notification::DownloadingLegacyManifest);
569569
}
@@ -574,7 +574,7 @@ pub fn update_from_dist_<'a>(
574574
// If the v2 manifest is not found then try v1
575575
let manifest = match dl_v1_manifest(download, toolchain) {
576576
Ok(m) => m,
577-
Err(Error(ErrorKind::Utils(crate::utils::ErrorKind::DownloadNotExists { .. }), _)) => {
577+
Err(Error(crate::ErrorKind::DownloadNotExists { .. }, _)) => {
578578
return Err(format!("no release found for '{}'", toolchain.manifest_name()).into());
579579
}
580580
Err(e @ Error(ErrorKind::ChecksumFailed { .. }, _)) => {
@@ -597,13 +597,12 @@ pub fn update_from_dist_<'a>(
597597
) {
598598
Ok(None) => Ok(None),
599599
Ok(Some(hash)) => Ok(Some(hash)),
600-
e @ Err(Error(ErrorKind::Utils(crate::utils::ErrorKind::DownloadNotExists { .. }), _)) => e
601-
.chain_err(|| {
602-
format!(
603-
"could not download nonexistent rust version `{}`",
604-
toolchain_str
605-
)
606-
}),
600+
e @ Err(Error(crate::ErrorKind::DownloadNotExists { .. }, _)) => e.chain_err(|| {
601+
format!(
602+
"could not download nonexistent rust version `{}`",
603+
toolchain_str
604+
)
605+
}),
607606
Err(e) => Err(e),
608607
}
609608
}

src/dist/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::dist::errors::*;
21
use crate::dist::notifications::*;
32
use crate::dist::temp;
3+
use crate::errors::*;
44
use crate::utils::utils;
55
use sha2::{Digest, Sha256};
66
use url::Url;

src/dist/errors.rs

Lines changed: 0 additions & 153 deletions
This file was deleted.

src/dist/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//!
1111
//! See tests/channel-rust-nightly-example.toml for an example.
1212
13-
use crate::dist::errors::*;
13+
use crate::errors::*;
1414
use crate::utils::toml_utils::*;
1515

1616
use crate::dist::dist::TargetTriple;

src/dist/manifestation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use crate::dist::component::{Components, Package, TarGzPackage, TarXzPackage, Tr
55
use crate::dist::config::Config;
66
use crate::dist::dist::{TargetTriple, DEFAULT_DIST_SERVER};
77
use crate::dist::download::{DownloadCfg, File};
8-
use crate::dist::errors::*;
98
use crate::dist::manifest::{Component, Manifest, TargetedPackage};
109
use crate::dist::notifications::*;
1110
use crate::dist::prefix::InstallPrefix;
1211
use crate::dist::temp;
12+
use crate::errors::*;
1313
use crate::utils::utils;
1414
use std::path::Path;
1515

src/dist/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Installation from a Rust distribution server
22
3-
pub use crate::dist::errors::*;
43
pub use crate::dist::notifications::Notification;
54

65
pub mod temp;
@@ -9,8 +8,6 @@ pub mod component;
98
pub mod config;
109
pub mod dist;
1110
pub mod download;
12-
#[allow(deprecated)] // WORKAROUND https://github.com/rust-lang-nursery/error-chain/issues/254
13-
pub mod errors;
1411
pub mod manifest;
1512
pub mod manifestation;
1613
pub mod notifications;

src/dist/notifications.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::dist::dist::TargetTriple;
2-
use crate::dist::errors::*;
32
use crate::dist::temp;
3+
use crate::errors::*;
44
use crate::utils::notify::NotificationLevel;
55
use std::fmt::{self, Display};
66
use std::path::Path;

0 commit comments

Comments
 (0)