File tree Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -166,19 +166,13 @@ impl Decode for GzipDecoder {
166166 output : & mut PartialBuffer < impl AsRef < [ u8 ] > + AsMut < [ u8 ] > > ,
167167 ) -> Result < bool > {
168168 match & mut self . state {
169- State :: Done => return Ok ( true ) ,
170- State :: Header ( parser) => {
171- // In this case, the input was an empty gzip. Exit successfully with an empty gzip.
172- if parser. has_no_content ( ) {
173- return Ok ( true ) ;
174- }
175- }
176- _ => { }
169+ State :: Done => Ok ( true ) ,
170+ // In this case, the input was an empty gzip. Exit successfully with an empty gzip.
171+ State :: Header ( parser) if parser. has_no_content ( ) => Ok ( true ) ,
172+ _ => Err ( Error :: new (
173+ ErrorKind :: UnexpectedEof ,
174+ "unexpected end of file" ,
175+ ) ) ,
177176 }
178-
179- Err ( Error :: new (
180- ErrorKind :: UnexpectedEof ,
181- "unexpected end of file" ,
182- ) )
183177 }
184178}
Original file line number Diff line number Diff line change 11use crate :: util:: PartialBuffer ;
2- use std:: io ;
2+ use std:: { io , iter } ;
33
44#[ derive( Debug , Default ) ]
55struct Flags {
@@ -163,9 +163,6 @@ impl Parser {
163163 }
164164
165165 pub ( super ) fn has_no_content ( & self ) -> bool {
166- match & self . state {
167- State :: Fixed ( data) => data. buffer ( ) . iter ( ) . all ( |& b| b == 0 ) ,
168- _ => false ,
169- }
166+ matches ! ( & self . state, State :: Fixed ( data) if data. buffer( ) . iter( ) . all( |& b| b == 0 ) )
170167 }
171168}
You can’t perform that action at this time.
0 commit comments