@@ -51,20 +51,17 @@ impl From<()> for AudioReadError {
51
51
}
52
52
}
53
53
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 { }
64
55
65
56
impl fmt:: Display for AudioReadError {
66
57
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)
68
65
}
69
66
}
70
67
@@ -120,7 +117,7 @@ fn floor_zero_decode(rdr :&mut BitpackCursor, codebooks :&[Codebook],
120
117
// This channel is unused in this frame,
121
118
// its all zeros.
122
119
return Err ( FloorSpecialCase :: Unused ) ;
123
- }
120
+ }
124
121
125
122
let booknumber = try!( rdr. read_dyn_u32 (
126
123
:: ilog ( fl. floor0_number_of_books as u64 ) ) ) ;
@@ -268,7 +265,7 @@ fn extr_neighbor<F>(v :&[u32], max_idx :usize,
268
265
// the criterion of being "smaller" than bound
269
266
let min_idx = prefix. iter ( )
270
267
. position ( |& val| smaller ( val, bound) )
271
- . unwrap_or_else ( ||
268
+ . unwrap_or_else ( ||
272
269
panic ! ( "No index y < {0} found where v[y] is {1} than v[{0}] = 0x{2:08x}!" ,
273
270
max_idx, relation, bound) ) ;
274
271
0 commit comments