Skip to content

Commit

Permalink
Auto merge of #5847 - alexcrichton:fix-deprecations, r=alexcrichton
Browse files Browse the repository at this point in the history
Upgrade to `failure 0.1.2` idioms

Fixes some deprecation warnings in Cargo
  • Loading branch information
bors committed Aug 1, 2018
2 parents 0b80061 + adbd625 commit d06fe7b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ crossbeam-utils = "0.5"
crypto-hash = "0.3.1"
curl = "0.4.13"
env_logger = "0.5.4"
failure = "0.1.1"
failure = "0.1.2"
filetime = "0.2"
flate2 = "1.0"
fs2 = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ fn log_compare(unit: &Unit, compare: &CargoResult<()>) {
};
info!("fingerprint error for {}: {}", unit.pkg, ce);

for cause in ce.causes().skip(1) {
for cause in ce.iter_causes() {
info!(" cause: {}", cause);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ fn handle_cause(cargo_err: &Error, shell: &mut Shell) -> bool {
if verbose == Verbose {
// The first error has already been printed to the shell
// Print all remaining errors
for err in cargo_err.causes().skip(1) {
for err in cargo_err.iter_causes() {
print(&err.to_string(), shell);
}
} else {
// The first error has already been printed to the shell
// Print remaining errors until one marked as Internal appears
for err in cargo_err.causes().skip(1) {
for err in cargo_err.iter_causes() {
if err.downcast_ref::<Internal>().is_some() {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ impl fmt::Display for ConfigError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let message = self
.error
.causes()
.iter_chain()
.map(|e| e.to_string())
.collect::<Vec<_>>()
.join("\nCaused by:\n ");
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Internal {

impl Fail for Internal {
fn cause(&self) -> Option<&Fail> {
self.inner.cause().cause()
self.inner.as_fail().cause()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use util::Config;
use util::errors::{CargoResult, HttpNot200};

fn maybe_spurious(err: &Error) -> bool {
for e in err.causes() {
for e in err.iter_chain() {
if let Some(git_err) = e.downcast_ref::<git2::Error>() {
match git_err.class() {
git2::ErrorClass::Net | git2::ErrorClass::Os => return true,
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn new_config(env: &[(&str, &str)]) -> Config {

fn assert_error(error: CargoError, msgs: &str) {
let causes = error
.causes()
.iter_chain()
.map(|e| e.to_string())
.collect::<Vec<_>>()
.join("\n");
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ impl<'a> ham::Matcher<&'a mut ProcessBuilder> for Execs {
return self.match_output(out);
}
let mut s = format!("could not exec process {}: {}", process, e);
for cause in e.causes() {
for cause in e.iter_causes() {
s.push_str(&format!("\ncaused by: {}", cause));
}
Err(s)
Expand Down

0 comments on commit d06fe7b

Please sign in to comment.