@@ -51,7 +51,7 @@ pub enum ConfigError {
51
51
52
52
/// The captured error from attempting to parse the file in its desired format.
53
53
/// 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 > ,
55
55
} ,
56
56
57
57
/// Value could not be converted into the requested type.
@@ -76,7 +76,7 @@ pub enum ConfigError {
76
76
Message ( String ) ,
77
77
78
78
/// Unadorned error from a foreign origin.
79
- Foreign ( Box < Error + Send + Sync > ) ,
79
+ Foreign ( Box < dyn Error + Send + Sync > ) ,
80
80
}
81
81
82
82
impl ConfigError {
@@ -88,9 +88,9 @@ impl ConfigError {
88
88
expected : & ' static str ,
89
89
) -> Self {
90
90
ConfigError :: Type {
91
- origin : origin ,
92
- unexpected : unexpected ,
93
- expected : expected ,
91
+ origin,
92
+ unexpected,
93
+ expected,
94
94
key : None ,
95
95
}
96
96
}
@@ -105,9 +105,9 @@ impl ConfigError {
105
105
expected,
106
106
..
107
107
} => ConfigError :: Type {
108
- origin : origin ,
109
- unexpected : unexpected ,
110
- expected : expected ,
108
+ origin,
109
+ unexpected,
110
+ expected,
111
111
key : Some ( key. into ( ) ) ,
112
112
} ,
113
113
@@ -166,7 +166,9 @@ impl fmt::Debug for ConfigError {
166
166
impl fmt:: Display for ConfigError {
167
167
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
168
168
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( ) ) ,
170
172
171
173
ConfigError :: Message ( ref s) => write ! ( f, "{}" , s) ,
172
174
@@ -208,31 +210,7 @@ impl fmt::Display for ConfigError {
208
210
}
209
211
}
210
212
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 { }
236
214
237
215
impl de:: Error for ConfigError {
238
216
fn custom < T : fmt:: Display > ( msg : T ) -> Self {
0 commit comments