From df081bede00a61f410f2c2f5aff8ab0e134003f0 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Mon, 28 Feb 2022 21:13:54 +0100 Subject: [PATCH] Changed impl `Error::cause()` to `Error::source()` This implements `source()` method instead of `cause()` allowing downcasting. --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f1cc95952..050b67482 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -377,8 +377,7 @@ impl fmt::Display for Error { #[cfg(feature = "std")] #[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl std::error::Error for Error { - #[allow(deprecated)] - fn cause(&self) -> Option<&dyn std::error::Error> { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { Error::IncorrectSignature => None, Error::InvalidMessage => None,