Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Remove deprecated Error::description #339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ with_std! {

use Error;

impl<E: Display + Debug> StdError for Compat<E> {
fn description(&self) -> &'static str {
"An error has occurred."
}
}
impl<E: Display + Debug> StdError for Compat<E> {}

impl From<Error> for Box<dyn StdError> {
fn from(error: Error) -> Box<dyn StdError> {
Expand Down
20 changes: 6 additions & 14 deletions src/result_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,23 @@ pub trait ResultExt<T, E> {
/// #
/// # #[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> {
Expand Down
6 changes: 1 addition & 5 deletions src/sync_failure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ impl<E: Error + Send + 'static> SyncFailure<E> {
///
/// // 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 {
Expand Down