Skip to content

Commit 9dee5b6

Browse files
authored
Merge pull request #501 from gcomte/fix/remove-deprecated-error-description
Replace deprecated Error::description() with thiserror
2 parents d12bb22 + 14023a5 commit 9dee5b6

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

src/cli_input.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use clap::Parser;
22
use colored::*;
33
use regex::Regex;
44
use si_unit_prefix::SiUnitPrefix;
5-
use std::error::Error;
6-
use std::fmt;
75
use std::num::ParseFloatError;
86

97
use crate::currencies::Currencies;
@@ -35,7 +33,8 @@ pub struct CliInput {
3533
pub integer: bool,
3634
}
3735

38-
#[derive(Debug)]
36+
#[derive(Debug, thiserror::Error)]
37+
#[error("{details}")]
3938
pub struct InputError {
4039
details: String,
4140
}
@@ -48,18 +47,6 @@ impl InputError {
4847
}
4948
}
5049

51-
impl fmt::Display for InputError {
52-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
53-
write!(f, "{}", self.details)
54-
}
55-
}
56-
57-
impl Error for InputError {
58-
fn description(&self) -> &str {
59-
&self.details
60-
}
61-
}
62-
6350
impl From<ParseFloatError> for InputError {
6451
fn from(err: ParseFloatError) -> Self {
6552
Self::new(&err.to_string())

0 commit comments

Comments
 (0)