Allow deprecated Error::cause (#818)

Error::cause is deprecated in Rust 1.33, but this allows Error::cause
until the minimum supported version of tokio is Rust 1.30.

When the minimum support version of tokio reaches Rust 1.30,
replace Error::cause with Error::source.

Fixes: #817
This commit is contained in:
Taiki Endo
2019-01-02 14:12:11 -08:00
committed by Carl Lerche
parent 30f59670c8
commit 9a8d087c69
2 changed files with 7 additions and 0 deletions
+4
View File
@@ -92,6 +92,10 @@ impl Error for RunError {
fn description(&self) -> &str {
self.inner.description()
}
// FIXME(taiki-e): When the minimum support version of tokio reaches Rust 1.30,
// replace this with Error::source.
#[allow(deprecated)]
fn cause(&self) -> Option<&Error> {
self.inner.cause()
}
+3
View File
@@ -161,6 +161,9 @@ impl<T: StdError + 'static> StdError for ThrottleError<T> {
}
}
// FIXME(taiki-e): When the minimum support version of tokio reaches Rust 1.30,
// replace this with Error::source.
#[allow(deprecated)]
fn cause(&self) -> Option<&StdError> {
match self.0 {
Either::A(ref err) => Some(err),