@@ -51,20 +51,17 @@ impl From<()> for AudioReadError {
5151 }
5252}
5353
54- impl error:: Error for AudioReadError {
55- fn description ( & self ) -> & str {
56- match self {
57- & AudioReadError :: EndOfPacket => "End of packet reached." ,
58- & AudioReadError :: AudioBadFormat => "Invalid audio packet" ,
59- & AudioReadError :: AudioIsHeader => "The vorbis version is not supported" ,
60- & AudioReadError :: BufferNotAddressable => "Requested to create buffer of non-addressable size" ,
61- }
62- }
63- }
54+ impl error:: Error for AudioReadError { }
6455
6556impl fmt:: Display for AudioReadError {
6657 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> Result < ( ) , fmt:: Error > {
67- write ! ( fmt, "{}" , error:: Error :: description( self ) )
58+ let description = match self {
59+ AudioReadError :: EndOfPacket => "End of packet reached." ,
60+ AudioReadError :: AudioBadFormat => "Invalid audio packet" ,
61+ AudioReadError :: AudioIsHeader => "The vorbis version is not supported" ,
62+ AudioReadError :: BufferNotAddressable => "Requested to create buffer of non-addressable size" ,
63+ } ;
64+ write ! ( fmt, "{}" , description)
6865 }
6966}
7067
@@ -120,7 +117,7 @@ fn floor_zero_decode(rdr :&mut BitpackCursor, codebooks :&[Codebook],
120117 // This channel is unused in this frame,
121118 // its all zeros.
122119 return Err ( FloorSpecialCase :: Unused ) ;
123- }
120+ }
124121
125122 let booknumber = try!( rdr. read_dyn_u32 (
126123 :: ilog ( fl. floor0_number_of_books as u64 ) ) ) ;
@@ -268,7 +265,7 @@ fn extr_neighbor<F>(v :&[u32], max_idx :usize,
268265 // the criterion of being "smaller" than bound
269266 let min_idx = prefix. iter ( )
270267 . position ( |& val| smaller ( val, bound) )
271- . unwrap_or_else ( ||
268+ . unwrap_or_else ( ||
272269 panic ! ( "No index y < {0} found where v[y] is {1} than v[{0}] = 0x{2:08x}!" ,
273270 max_idx, relation, bound) ) ;
274271
0 commit comments