@@ -51,7 +51,7 @@ pub enum ConfigError {
5151
5252 /// The captured error from attempting to parse the file in its desired format.
5353 /// This is the actual error object from the library used for the parsing.
54- cause : Box < Error + Send + Sync > ,
54+ cause : Box < dyn Error + Send + Sync > ,
5555 } ,
5656
5757 /// Value could not be converted into the requested type.
@@ -76,7 +76,7 @@ pub enum ConfigError {
7676 Message ( String ) ,
7777
7878 /// Unadorned error from a foreign origin.
79- Foreign ( Box < Error + Send + Sync > ) ,
79+ Foreign ( Box < dyn Error + Send + Sync > ) ,
8080}
8181
8282impl ConfigError {
@@ -88,9 +88,9 @@ impl ConfigError {
8888 expected : & ' static str ,
8989 ) -> Self {
9090 ConfigError :: Type {
91- origin : origin ,
92- unexpected : unexpected ,
93- expected : expected ,
91+ origin,
92+ unexpected,
93+ expected,
9494 key : None ,
9595 }
9696 }
@@ -105,9 +105,9 @@ impl ConfigError {
105105 expected,
106106 ..
107107 } => ConfigError :: Type {
108- origin : origin ,
109- unexpected : unexpected ,
110- expected : expected ,
108+ origin,
109+ unexpected,
110+ expected,
111111 key : Some ( key. into ( ) ) ,
112112 } ,
113113
@@ -166,7 +166,9 @@ impl fmt::Debug for ConfigError {
166166impl fmt:: Display for ConfigError {
167167 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
168168 match * self {
169- ConfigError :: Frozen | ConfigError :: PathParse ( _) => write ! ( f, "{}" , self . description( ) ) ,
169+ ConfigError :: Frozen => write ! ( f, "configuration is frozen" ) ,
170+
171+ ConfigError :: PathParse ( ref kind) => write ! ( f, "{}" , kind. description( ) ) ,
170172
171173 ConfigError :: Message ( ref s) => write ! ( f, "{}" , s) ,
172174
@@ -208,31 +210,7 @@ impl fmt::Display for ConfigError {
208210 }
209211}
210212
211- impl Error for ConfigError {
212- fn description ( & self ) -> & str {
213- match * self {
214- ConfigError :: Frozen => "configuration is frozen" ,
215- ConfigError :: NotFound ( _) => "configuration property not found" ,
216- ConfigError :: Type { .. } => "invalid type" ,
217- ConfigError :: Foreign ( ref cause) | ConfigError :: FileParse { ref cause, .. } => {
218- cause. description ( )
219- }
220- ConfigError :: PathParse ( ref kind) => kind. description ( ) ,
221-
222- _ => "configuration error" ,
223- }
224- }
225-
226- fn cause ( & self ) -> Option < & Error > {
227- match * self {
228- ConfigError :: Foreign ( ref cause) | ConfigError :: FileParse { ref cause, .. } => {
229- Some ( cause. as_ref ( ) )
230- }
231-
232- _ => None ,
233- }
234- }
235- }
213+ impl Error for ConfigError { }
236214
237215impl de:: Error for ConfigError {
238216 fn custom < T : fmt:: Display > ( msg : T ) -> Self {
0 commit comments