Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
9 changes: 8 additions & 1 deletion src/imp/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,19 @@ impl error::Error for Error {
}
}

fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just remove the cause implementations - they'll delegate to source anyway.

match *self {
Error::Normal(ref e) => error::Error::cause(e),
Error::Ssl(ref e, _) => error::Error::cause(e),
}
}

fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match *self {
Error::Normal(ref e) => Some(e),
Error::Ssl(ref e, _) => Some(e),
}
}
}

impl fmt::Display for Error {
Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ impl error::Error for Error {
error::Error::description(&self.0)
}

fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
error::Error::cause(&self.0)
}

fn source(&self) -> Option<&(dyn error::Error + 'static)> {
error::Error::source(&self.0)
}
}

impl fmt::Display for Error {
Expand Down