@@ -90,7 +90,7 @@ impl<'e, E: Engine, R: io::Read> DecoderReader<'e, E, R> {
90
90
/// Returns a Result with the number of (decoded) bytes copied.
91
91
fn flush_decoded_buf ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
92
92
debug_assert ! ( self . decoded_len > 0 ) ;
93
- debug_assert ! ( buf. len ( ) > 0 ) ;
93
+ debug_assert ! ( ! buf. is_empty ( ) ) ;
94
94
95
95
let copy_len = cmp:: min ( self . decoded_len , buf. len ( ) ) ;
96
96
debug_assert ! ( copy_len > 0 ) ;
@@ -121,7 +121,7 @@ impl<'e, E: Engine, R: io::Read> DecoderReader<'e, E, R> {
121
121
122
122
debug_assert ! ( self . b64_offset + self . b64_len <= BUF_SIZE ) ;
123
123
124
- return Ok ( read) ;
124
+ Ok ( read)
125
125
}
126
126
127
127
/// Decode the requested number of bytes from the b64 buffer into the provided buffer. It's the
@@ -131,11 +131,11 @@ impl<'e, E: Engine, R: io::Read> DecoderReader<'e, E, R> {
131
131
fn decode_to_buf ( & mut self , num_bytes : usize , buf : & mut [ u8 ] ) -> io:: Result < usize > {
132
132
debug_assert ! ( self . b64_len >= num_bytes) ;
133
133
debug_assert ! ( self . b64_offset + self . b64_len <= BUF_SIZE ) ;
134
- debug_assert ! ( buf. len ( ) > 0 ) ;
134
+ debug_assert ! ( ! buf. is_empty ( ) ) ;
135
135
136
136
let decoded = decode_engine_slice (
137
137
& self . b64_buffer [ self . b64_offset ..self . b64_offset + num_bytes] ,
138
- & mut buf[ .. ] ,
138
+ buf,
139
139
self . engine ,
140
140
)
141
141
. map_err ( |e| match e {
@@ -183,7 +183,7 @@ impl<'e, E: Engine, R: Read> Read for DecoderReader<'e, E, R> {
183
183
/// Any errors emitted by the delegate reader are returned. Decoding errors due to invalid
184
184
/// base64 are also possible, and will have `io::ErrorKind::InvalidData`.
185
185
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
186
- if buf. len ( ) == 0 {
186
+ if buf. is_empty ( ) {
187
187
return Ok ( 0 ) ;
188
188
}
189
189
0 commit comments