File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ use clap::Parser;
22use colored:: * ;
33use regex:: Regex ;
44use si_unit_prefix:: SiUnitPrefix ;
5- use std:: error:: Error ;
6- use std:: fmt;
75use std:: num:: ParseFloatError ;
86
97use 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}" ) ]
3938pub 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-
6350impl From < ParseFloatError > for InputError {
6451 fn from ( err : ParseFloatError ) -> Self {
6552 Self :: new ( & err. to_string ( ) )
You can’t perform that action at this time.
0 commit comments