@@ -177,13 +177,6 @@ impl FileMetadata {
177
177
file_read. read ( start..end) . await
178
178
}
179
179
180
- fn err_out_of_bounds < T > ( ) -> Result < T > {
181
- Err ( Error :: new (
182
- ErrorKind :: DataInvalid ,
183
- "Index range is out of bounds." ,
184
- ) )
185
- }
186
-
187
180
fn decode_flags ( footer_bytes : & [ u8 ] ) -> Result < HashSet < Flag > > {
188
181
let mut flags = HashSet :: new ( ) ;
189
182
for byte_number in 0 ..FileMetadata :: FOOTER_STRUCT_FLAGS_LENGTH {
@@ -193,7 +186,10 @@ impl FileMetadata {
193
186
+ usize:: from ( byte_number) ;
194
187
195
188
let mut flag_byte = match footer_bytes. get ( byte_offset) {
196
- None => FileMetadata :: err_out_of_bounds ( ) ,
189
+ None => Err ( Error :: new (
190
+ ErrorKind :: DataInvalid ,
191
+ "Index range is out of bounds." ,
192
+ ) ) ,
197
193
Some ( byte) => Ok ( * byte) ,
198
194
} ?;
199
195
let mut bit_number = 0 ;
@@ -234,7 +230,10 @@ impl FileMetadata {
234
230
let end_offset =
235
231
usize:: from ( FileMetadata :: MAGIC_LENGTH ) + usize:: try_from ( footer_payload_length) ?;
236
232
let footer_payload_bytes = match footer_bytes. get ( start_offset..end_offset) {
237
- None => FileMetadata :: err_out_of_bounds ( ) ,
233
+ None => Err ( Error :: new (
234
+ ErrorKind :: DataInvalid ,
235
+ "Index range is out of bounds." ,
236
+ ) ) ,
238
237
Some ( data) => Ok ( data) ,
239
238
} ?;
240
239
let decompressed_footer_payload_bytes =
0 commit comments