From 08368b2a730433eed0774dcd6174f0290fde8cad Mon Sep 17 00:00:00 2001 From: VC Date: Tue, 3 May 2022 12:14:23 +0200 Subject: [PATCH] refactor(error): remove deprecated description() --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/error.rs | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index abb5bf9..f39fb48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2016,7 +2016,7 @@ dependencies = [ [[package]] name = "scootaloo" -version = "0.5.1" +version = "0.5.2" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 1e7849f..f0d75b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scootaloo" -version = "0.5.1" +version = "0.5.2" authors = ["VC "] edition = "2021" diff --git a/src/error.rs b/src/error.rs index a44482c..4edca87 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,7 @@ -use std::fmt; +use std::{ + fmt::{Display, Formatter, Result}, + error::Error, +}; #[derive(Debug)] pub struct ScootalooError { @@ -13,15 +16,11 @@ impl ScootalooError { } } -impl fmt::Display for ScootalooError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +impl Error for ScootalooError {} + +impl Display for ScootalooError { + fn fmt(&self, f: &mut Formatter) -> Result { write!(f, "{}", self.details) } } -impl std::error::Error for ScootalooError { - fn description(&self) -> &str { - &self.details - } -} -