From 42cca4cd5f4aa66c6d617081710febd36f2c3324 Mon Sep 17 00:00:00 2001 From: Jan Ole Zabel <joz@spline.de> Date: Thu, 13 Feb 2020 23:26:55 +0100 Subject: [PATCH] Stop using deprecated Error.description() function --- src/error.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/error.rs b/src/error.rs index 19df21d..b0fdb1f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,5 @@ use serde_json::error::Category; use std::error; -use std::error::Error; use std::fmt; #[derive(Debug)] @@ -13,11 +12,12 @@ pub enum AurError { impl error::Error for AurError { fn description(&self) -> &str { match self { - AurError::ProcessErr(e) => e.description(), - AurError::JsonErr(e) => e.description(), + AurError::ProcessErr(_) => "Process error", + AurError::JsonErr(_) => "JSON error while using the AUR", AurError::Arbitrary(s) => s, } } + fn cause(&self) -> Option<&dyn error::Error> { match self { AurError::ProcessErr(e) => e.source(), @@ -30,7 +30,7 @@ impl error::Error for AurError { impl fmt::Display for AurError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - AurError::ProcessErr(e) => write!(f, "{}", e.description()), + AurError::ProcessErr(e) => write!(f, "{}", e), AurError::JsonErr(e) => match e.classify() { Category::Io => write!(f, "{}", "failure to read or write bytes on an IO stream"), Category::Syntax => write!(f, "not syntactically valid JSON"), -- GitLab