@@ -88,7 +88,7 @@ struct Location {
8888impl < R > Parser < R > where R : BufRead + Seek {
8989 fn new ( reader : R ) -> Self {
9090 Self {
91- reader : reader ,
91+ reader,
9292 ftyp_checked : false ,
9393 item_id : None ,
9494 item_location : None ,
@@ -127,7 +127,7 @@ impl<R> Parser<R> where R: BufRead + Seek {
127127 let mut buf = [ 0 ; 8 ] ;
128128 self . reader . read_exact ( & mut buf) ?;
129129 let size = match BigEndian :: loadu32 ( & buf, 0 ) {
130- 0 => Some ( std :: u64:: MAX ) ,
130+ 0 => Some ( u64:: MAX ) ,
131131 1 => read64 ( & mut self . reader ) ?. checked_sub ( 16 ) ,
132132 x => u64:: from ( x) . checked_sub ( 8 ) ,
133133 } . ok_or ( "Invalid box size" ) ?;
@@ -138,7 +138,7 @@ impl<R> Parser<R> where R: BufRead + Seek {
138138 fn read_file_level_box ( & mut self , size : u64 ) -> Result < Vec < u8 > , Error > {
139139 let mut buf;
140140 match size {
141- std :: u64:: MAX => {
141+ u64:: MAX => {
142142 buf = Vec :: new ( ) ;
143143 self . reader . read_to_end ( & mut buf) ?;
144144 } ,
@@ -154,7 +154,7 @@ impl<R> Parser<R> where R: BufRead + Seek {
154154
155155 fn skip_file_level_box ( & mut self , size : u64 ) -> Result < ( ) , Error > {
156156 match size {
157- std :: u64:: MAX => self . reader . seek ( SeekFrom :: End ( 0 ) ) ?,
157+ u64:: MAX => self . reader . seek ( SeekFrom :: End ( 0 ) ) ?,
158158 _ => self . reader . seek ( SeekFrom :: Current (
159159 size. try_into ( ) . or ( Err ( "Large seek not supported" ) ) ?) ) ?,
160160 } ;
@@ -164,7 +164,7 @@ impl<R> Parser<R> where R: BufRead + Seek {
164164 fn parse_ftyp ( & mut self , mut boxp : BoxSplitter ) -> Result < ( ) , Error > {
165165 let head = boxp. slice ( 8 ) ?;
166166 let _major_brand = & head[ 0 ..4 ] ;
167- let _minor_version = BigEndian :: loadu32 ( & head, 4 ) ;
167+ let _minor_version = BigEndian :: loadu32 ( head, 4 ) ;
168168 while let Ok ( compat_brand) = boxp. array4 ( ) {
169169 if HEIF_BRANDS . contains ( & compat_brand) {
170170 return Ok ( ( ) ) ;
@@ -301,9 +301,8 @@ impl<R> Parser<R> where R: BufRead + Seek {
301301 } ;
302302 for _ in 0 ..entry_count {
303303 let ( boxtype, body) = boxp. child_box ( ) ?;
304- match boxtype {
305- b"infe" => self . parse_infe ( body) ?,
306- _ => { } ,
304+ if boxtype == b"infe" {
305+ self . parse_infe ( body) ?
307306 }
308307 }
309308 Ok ( ( ) )
@@ -483,7 +482,7 @@ mod tests {
483482 // to the end of the file
484483 let mut p = Parser :: new ( Cursor :: new ( b"\0 \0 \0 \0 abcd" ) ) ;
485484 assert_eq ! ( p. read_box_header( ) . unwrap( ) ,
486- Some ( ( std :: u64 :: MAX , * b"abcd" ) ) ) ;
485+ Some ( ( u64 :: MAX , * b"abcd" ) ) ) ;
487486 // largesize
488487 let mut p = Parser :: new ( Cursor :: new (
489488 b"\0 \0 \0 \x01 abcd\0 \0 \0 \0 \0 \0 \0 \x10 " ) ) ;
@@ -498,7 +497,7 @@ mod tests {
498497 let mut p = Parser :: new ( Cursor :: new (
499498 b"\0 \0 \0 \x01 abcd\xff \xff \xff \xff \xff \xff \xff \xff " ) ) ;
500499 assert_eq ! ( p. read_box_header( ) . unwrap( ) ,
501- Some ( ( std :: u64 :: MAX . wrapping_sub( 16 ) , * b"abcd" ) ) ) ;
500+ Some ( ( u64 :: MAX . wrapping_sub( 16 ) , * b"abcd" ) ) ) ;
502501 }
503502
504503 #[ test]
0 commit comments