Skip to content

Commit

Permalink
Merge pull request #1151 from yerke/remove-deprecated-methods-from-er…
Browse files Browse the repository at this point in the history
…ror-trait

Do not use deprecated functions from `std::error::Error` trait
  • Loading branch information
marioidival authored Feb 23, 2019
2 parents 126ba22 + 9143868 commit 6fa6d9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/error/multiple_error_types/define_error_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ impl fmt::Display for DoubleError {
// This is important for other errors to wrap this one.
impl error::Error for DoubleError {
fn description(&self) -> &str {
"invalid first item to double"
}
fn cause(&self) -> Option<&error::Error> {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
// Generic error, underlying cause isn't tracked.
None
}
Expand Down
10 changes: 1 addition & 9 deletions src/error/multiple_error_types/wrap_error.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ impl fmt::Display for DoubleError {
}
impl error::Error for DoubleError {
fn description(&self) -> &str {
match *self {
DoubleError::EmptyVec => "empty vectors not allowed",
// This already impls `Error`, so defer to its own implementation.
DoubleError::Parse(ref e) => e.description(),
}
}
fn cause(&self) -> Option<&error::Error> {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match *self {
DoubleError::EmptyVec => None,
// The cause is the underlying implementation error type. Is implicitly
Expand Down

0 comments on commit 6fa6d9e

Please sign in to comment.