Skip to content

Commit 5bf9f4f

Browse files
committed
remove deprecated usage of the cause function
1 parent 40dee34 commit 5bf9f4f

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/codec/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl Display for HttpCodecError {
228228
}
229229

230230
impl Error for HttpCodecError {
231-
fn cause(&self) -> Option<&dyn Error> {
231+
fn source(&self) -> Option<&(dyn Error + 'static)> {
232232
match *self {
233233
HttpCodecError::Io(ref error) => Some(error),
234234
HttpCodecError::Http(ref error) => Some(error),

src/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl fmt::Display for WebSocketOtherError {
9292
}
9393

9494
impl Error for WebSocketOtherError {
95-
fn cause(&self) -> Option<&dyn Error> {
95+
fn source(&self) -> Option<&(dyn Error + 'static)> {
9696
match *self {
9797
WebSocketOtherError::HttpError(ref error) => Some(error),
9898
WebSocketOtherError::UrlError(ref error) => Some(error),

src/server/upgrade/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl Display for HyperIntoWsError {
217217
}
218218

219219
impl Error for HyperIntoWsError {
220-
fn cause(&self) -> Option<&dyn Error> {
220+
fn source(&self) -> Option<&(dyn Error + 'static)> {
221221
match *self {
222222
HyperIntoWsError::Io(ref e) => Some(e),
223223
HyperIntoWsError::Parsing(ref e) => Some(e),

websocket-base/src/result.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ impl fmt::Display for WebSocketError {
5454
}
5555

5656
impl Error for WebSocketError {
57-
#[allow(deprecated)]
58-
fn cause(&self) -> Option<&dyn Error> {
57+
fn source(&self) -> Option<&(dyn Error + 'static)> {
5958
match *self {
6059
WebSocketError::IoError(ref error) => Some(error),
6160
WebSocketError::Utf8Error(ref error) => Some(error),
62-
WebSocketError::Other(ref error) => error.cause(),
61+
WebSocketError::Other(ref error) => error.source(),
6362
_ => None,
6463
}
6564
}

0 commit comments

Comments
 (0)