Skip to content

Commit 6fa6d9e

Browse files
authored
Merge pull request #1151 from yerke/remove-deprecated-methods-from-error-trait
Do not use deprecated functions from `std::error::Error` trait
2 parents 126ba22 + 9143868 commit 6fa6d9e

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/error/multiple_error_types/define_error_type.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ impl fmt::Display for DoubleError {
4040
4141
// This is important for other errors to wrap this one.
4242
impl error::Error for DoubleError {
43-
fn description(&self) -> &str {
44-
"invalid first item to double"
45-
}
46-
47-
fn cause(&self) -> Option<&error::Error> {
43+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
4844
// Generic error, underlying cause isn't tracked.
4945
None
5046
}

src/error/multiple_error_types/wrap_error.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@ impl fmt::Display for DoubleError {
2929
}
3030
3131
impl error::Error for DoubleError {
32-
fn description(&self) -> &str {
33-
match *self {
34-
DoubleError::EmptyVec => "empty vectors not allowed",
35-
// This already impls `Error`, so defer to its own implementation.
36-
DoubleError::Parse(ref e) => e.description(),
37-
}
38-
}
39-
40-
fn cause(&self) -> Option<&error::Error> {
32+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
4133
match *self {
4234
DoubleError::EmptyVec => None,
4335
// The cause is the underlying implementation error type. Is implicitly

0 commit comments

Comments
 (0)