@@ -45,13 +45,7 @@ pub mod audio {
45
45
46
46
impl :: std:: fmt:: Display for Error {
47
47
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter ) -> Result < ( ) , :: std:: fmt:: Error > {
48
- write ! ( f, "{:?}" , self )
49
- }
50
- }
51
-
52
- impl :: std:: error:: Error for Error {
53
- fn description ( & self ) -> & str {
54
- match * self {
48
+ let description = match * self {
55
49
Error :: Unimplemented => "Unimplemented" ,
56
50
Error :: FileNotFound => "File not found" ,
57
51
Error :: FilePermission => "File permission" ,
@@ -60,7 +54,8 @@ pub mod audio {
60
54
Error :: Param => "Param" ,
61
55
Error :: MemFull => "Memory full" ,
62
56
Error :: Unknown => "An unknown error occurred" ,
63
- }
57
+ } ;
58
+ write ! ( f, "{}" , description)
64
59
}
65
60
}
66
61
@@ -106,13 +101,7 @@ pub mod audio_codec {
106
101
107
102
impl :: std:: fmt:: Display for Error {
108
103
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter ) -> Result < ( ) , :: std:: fmt:: Error > {
109
- write ! ( f, "{:?}" , self )
110
- }
111
- }
112
-
113
- impl :: std:: error:: Error for Error {
114
- fn description ( & self ) -> & str {
115
- match * self {
104
+ let description = match * self {
116
105
Error :: Unspecified => "Unspecified" ,
117
106
Error :: UnknownProperty => "Unknown property" ,
118
107
Error :: BadPropertySize => "Bad property size" ,
@@ -121,7 +110,8 @@ pub mod audio_codec {
121
110
Error :: State => "State" ,
122
111
Error :: NotEnoughBufferSpace => "Not enough buffer space" ,
123
112
Error :: Unknown => "Unknown error occurred" ,
124
- }
113
+ } ;
114
+ write ! ( f, "{}" , description)
125
115
}
126
116
}
127
117
@@ -161,21 +151,16 @@ pub mod audio_format {
161
151
162
152
impl :: std:: fmt:: Display for Error {
163
153
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter ) -> Result < ( ) , :: std:: fmt:: Error > {
164
- write ! ( f, "{:?}" , self )
165
- }
166
- }
167
-
168
- impl :: std:: error:: Error for Error {
169
- fn description ( & self ) -> & str {
170
- match * self {
154
+ let description = match * self {
171
155
Error :: Unspecified => "An unspecified error" ,
172
156
Error :: UnsupportedProperty => "The specified property is not supported" ,
173
157
Error :: BadPropertySize => "Bad property size" ,
174
158
Error :: BadSpecifierSize => "Bad specifier size" ,
175
159
Error :: UnsupportedDataFormat => "The specified data format is not supported" ,
176
160
Error :: UnknownFormat => "The specified data format is not a known format" ,
177
161
Error :: Unknown => "Unknown error occurred" ,
178
- }
162
+ } ;
163
+ write ! ( f, "{}" , description)
179
164
}
180
165
}
181
166
}
@@ -239,13 +224,7 @@ pub mod audio_unit {
239
224
240
225
impl :: std:: fmt:: Display for Error {
241
226
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter ) -> Result < ( ) , :: std:: fmt:: Error > {
242
- write ! ( f, "{:?}" , self )
243
- }
244
- }
245
-
246
- impl :: std:: error:: Error for Error {
247
- fn description ( & self ) -> & str {
248
- match * self {
227
+ let description = match * self {
249
228
Error :: InvalidProperty => "Invalid property" ,
250
229
Error :: InvalidParameter => "Invalid parameter" ,
251
230
Error :: InvalidElement => "Invalid element" ,
@@ -264,7 +243,8 @@ pub mod audio_unit {
264
243
Error :: InvalidOfflineRender => "Invalid offline render" ,
265
244
Error :: Unauthorized => "Unauthorized" ,
266
245
Error :: Unknown => "Unknown error occurred" ,
267
- }
246
+ } ;
247
+ write ! ( f, "{}" , description)
268
248
}
269
249
}
270
250
@@ -338,25 +318,18 @@ impl Error {
338
318
339
319
impl :: std:: fmt:: Display for Error {
340
320
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter ) -> Result < ( ) , :: std:: fmt:: Error > {
341
- write ! ( f, "{:?}" , self )
342
- }
343
- }
344
-
345
- impl :: std:: error:: Error for Error {
346
- fn description ( & self ) -> & str {
347
321
match * self {
348
- Error :: Unspecified => "An unspecified error has occurred" ,
349
- Error :: NoMatchingDefaultAudioUnitFound => "No matching default audio unit found" ,
322
+ Error :: Unspecified => write ! ( f , "An unspecified error has occurred" ) ,
323
+ Error :: NoMatchingDefaultAudioUnitFound => write ! ( f , "No matching default audio unit found" ) ,
350
324
Error :: RenderCallbackBufferFormatDoesNotMatchAudioUnitStreamFormat =>
351
- "The given render callback buffer format does not match the `AudioUnit` `StreamFormat`" ,
352
- Error :: SystemSoundClientMessageTimedOut => "The system sound client message timed out" ,
353
- Error :: NoKnownSubtype => "The type has no known subtypes" ,
354
- Error :: Audio ( ref err) => err . description ( ) ,
355
- Error :: AudioCodec ( ref err) => err . description ( ) ,
356
- Error :: AudioFormat ( ref err) => err . description ( ) ,
357
- Error :: AudioUnit ( ref err) => err . description ( ) ,
358
- Error :: Unknown ( _) => "An unknown error unknown to the coreaudio-rs API occurred" ,
325
+ write ! ( f , "The given render callback buffer format does not match the `AudioUnit` `StreamFormat`" ) ,
326
+ Error :: SystemSoundClientMessageTimedOut => write ! ( f , "The system sound client message timed out" ) ,
327
+ Error :: NoKnownSubtype => write ! ( f , "The type has no known subtypes" ) ,
328
+ Error :: Audio ( ref err) => write ! ( f , "{}" , err ) ,
329
+ Error :: AudioCodec ( ref err) => write ! ( f , "{}" , err ) ,
330
+ Error :: AudioFormat ( ref err) => write ! ( f , "{}" , err ) ,
331
+ Error :: AudioUnit ( ref err) => write ! ( f , "{}" , err ) ,
332
+ Error :: Unknown ( _) => write ! ( f , "An unknown error unknown to the coreaudio-rs API occurred" ) ,
359
333
}
360
334
}
361
335
}
362
-
0 commit comments