From 799495b847727536da0dd51466a67f40c9eb5b0a Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Mon, 28 Mar 2022 16:44:03 +0200 Subject: Implement std::error::Error::source Error::cause() is deprecated since Rust 1.33. --- askama_shared/src/error.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'askama_shared/src') diff --git a/askama_shared/src/error.rs b/askama_shared/src/error.rs index 98f2703..7c959a6 100644 --- a/askama_shared/src/error.rs +++ b/askama_shared/src/error.rs @@ -41,14 +41,14 @@ pub enum Error { } impl std::error::Error for Error { - fn cause(&self) -> Option<&dyn std::error::Error> { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match *self { - Error::Fmt(ref err) => err.source(), + Error::Fmt(ref err) => Some(err), Error::Custom(ref err) => Some(err.as_ref()), #[cfg(feature = "serde_json")] - Error::Json(ref err) => err.source(), + Error::Json(ref err) => Some(err), #[cfg(feature = "serde_yaml")] - Error::Yaml(ref err) => err.source(), + Error::Yaml(ref err) => Some(err), } } } -- cgit