@@ -45,13 +45,7 @@ pub mod audio {
4545
4646 impl :: std:: fmt:: Display for Error {
4747 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 {
5549 Error :: Unimplemented => "Unimplemented" ,
5650 Error :: FileNotFound => "File not found" ,
5751 Error :: FilePermission => "File permission" ,
@@ -60,7 +54,8 @@ pub mod audio {
6054 Error :: Param => "Param" ,
6155 Error :: MemFull => "Memory full" ,
6256 Error :: Unknown => "An unknown error occurred" ,
63- }
57+ } ;
58+ write ! ( f, "{}" , description)
6459 }
6560 }
6661
@@ -106,13 +101,7 @@ pub mod audio_codec {
106101
107102 impl :: std:: fmt:: Display for Error {
108103 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 {
116105 Error :: Unspecified => "Unspecified" ,
117106 Error :: UnknownProperty => "Unknown property" ,
118107 Error :: BadPropertySize => "Bad property size" ,
@@ -121,7 +110,8 @@ pub mod audio_codec {
121110 Error :: State => "State" ,
122111 Error :: NotEnoughBufferSpace => "Not enough buffer space" ,
123112 Error :: Unknown => "Unknown error occurred" ,
124- }
113+ } ;
114+ write ! ( f, "{}" , description)
125115 }
126116 }
127117
@@ -161,21 +151,16 @@ pub mod audio_format {
161151
162152 impl :: std:: fmt:: Display for Error {
163153 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 {
171155 Error :: Unspecified => "An unspecified error" ,
172156 Error :: UnsupportedProperty => "The specified property is not supported" ,
173157 Error :: BadPropertySize => "Bad property size" ,
174158 Error :: BadSpecifierSize => "Bad specifier size" ,
175159 Error :: UnsupportedDataFormat => "The specified data format is not supported" ,
176160 Error :: UnknownFormat => "The specified data format is not a known format" ,
177161 Error :: Unknown => "Unknown error occurred" ,
178- }
162+ } ;
163+ write ! ( f, "{}" , description)
179164 }
180165 }
181166}
@@ -239,13 +224,7 @@ pub mod audio_unit {
239224
240225 impl :: std:: fmt:: Display for Error {
241226 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 {
249228 Error :: InvalidProperty => "Invalid property" ,
250229 Error :: InvalidParameter => "Invalid parameter" ,
251230 Error :: InvalidElement => "Invalid element" ,
@@ -264,7 +243,8 @@ pub mod audio_unit {
264243 Error :: InvalidOfflineRender => "Invalid offline render" ,
265244 Error :: Unauthorized => "Unauthorized" ,
266245 Error :: Unknown => "Unknown error occurred" ,
267- }
246+ } ;
247+ write ! ( f, "{}" , description)
268248 }
269249 }
270250
@@ -338,25 +318,18 @@ impl Error {
338318
339319impl :: std:: fmt:: Display for Error {
340320 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 {
347321 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" ) ,
350324 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" ) ,
359333 }
360334 }
361335}
362-
0 commit comments