From: Vasudev Kamath Date: Mon, 13 Aug 2018 15:07:13 +0000 (+0530) Subject: Replace causes() with iter_chain() X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ae90356b27ce7f5510633c4b568e584eea6c2d6d;p=cargo.git Replace causes() with iter_chain() causes() in failure crate is deprecated and since cargo does not allow warnings causes build failure. Forwarded: no Last-Update: 2018-08-11 Gbp-Pq: Name 1001_failure_deprecated_fix.patch --- diff --git a/src/cargo/core/compiler/fingerprint.rs b/src/cargo/core/compiler/fingerprint.rs index e3783ddb6..aae269642 100644 --- a/src/cargo/core/compiler/fingerprint.rs +++ b/src/cargo/core/compiler/fingerprint.rs @@ -679,7 +679,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_chain().skip(1) { info!(" cause: {}", cause); } } diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index e51dfe87a..ed7cc9da4 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -169,13 +169,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_chain().skip(1) { 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_chain().skip(1) { if err.downcast_ref::().is_some() { return false; } diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 2b4bdf565..388476bcd 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -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::>() .join("\nCaused by:\n "); diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index bbbaa7854..e8c044918 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -56,7 +56,7 @@ impl Internal { impl Fail for Internal { fn cause(&self) -> Option<&Fail> { - self.inner.cause().cause() + self.inner.as_fail().cause() } } diff --git a/src/cargo/util/network.rs b/src/cargo/util/network.rs index 55b18a4cd..cc389cc2b 100644 --- a/src/cargo/util/network.rs +++ b/src/cargo/util/network.rs @@ -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::() { match git_err.class() { git2::ErrorClass::Net | git2::ErrorClass::Os => return true, diff --git a/tests/testsuite/cargotest/support/mod.rs b/tests/testsuite/cargotest/support/mod.rs index 677f90a31..112ea059f 100644 --- a/tests/testsuite/cargotest/support/mod.rs +++ b/tests/testsuite/cargotest/support/mod.rs @@ -1067,7 +1067,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_chain() { s.push_str(&format!("\ncaused by: {}", cause)); } Err(s) diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index f9d33e8c4..68375c615 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -69,7 +69,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::>() .join("\n");