From 85651bd7eceb1576ec31b3fe6d0d76a989b1a42b Mon Sep 17 00:00:00 2001 From: Andrii Radyk Date: Sun, 15 Dec 2019 21:58:46 +0100 Subject: [PATCH] remove deprecated Error::description --- src/compat.rs | 6 +----- src/result_ext.rs | 20 ++++++-------------- src/sync_failure.rs | 6 +----- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/compat.rs b/src/compat.rs index dec5383..1ac8cbb 100644 --- a/src/compat.rs +++ b/src/compat.rs @@ -33,11 +33,7 @@ with_std! { use Error; - impl StdError for Compat { - fn description(&self) -> &'static str { - "An error has occurred." - } - } + impl StdError for Compat {} impl From for Box { fn from(error: Error) -> Box { diff --git a/src/result_ext.rs b/src/result_ext.rs index f4125cd..cc68c7a 100644 --- a/src/result_ext.rs +++ b/src/result_ext.rs @@ -18,31 +18,23 @@ pub trait ResultExt { /// # /// # #[cfg(all(feature = "std", feature = "derive"))] mod tests { /// use std::error::Error; - /// # use std::fmt; + /// use std::fmt; /// # /// # extern crate failure; /// # /// # use tests::failure::ResultExt; /// # - /// # #[derive(Debug)] + /// #[derive(Debug)] /// struct CustomError; /// - /// impl Error for CustomError { - /// fn description(&self) -> &str { - /// "My custom error message" - /// } + /// impl Error for CustomError {} /// - /// fn cause(&self) -> Option<&Error> { - /// None + /// impl fmt::Display for CustomError { + /// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + /// write!(f, "My custom error message") /// } /// } /// # - /// # impl fmt::Display for CustomError { - /// # fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - /// # write!(f, "{}", self.description()) - /// # } - /// # } - /// # /// # pub fn run_test() { /// /// let x = (|| -> Result<(), failure::Error> { diff --git a/src/sync_failure.rs b/src/sync_failure.rs index 63e966c..53553ea 100644 --- a/src/sync_failure.rs +++ b/src/sync_failure.rs @@ -39,11 +39,7 @@ impl SyncFailure { /// /// // implement Display/Error for NonSyncError... /// # - /// # impl StdError for NonSyncError { - /// # fn description(&self) -> &str { - /// # "oops!" - /// # } - /// # } + /// # impl StdError for NonSyncError {} /// # /// # impl Display for NonSyncError { /// # fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {