File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed
crates/iceberg/src/puffin Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -240,24 +240,16 @@ impl FileMetadata {
240
240
let decompressed_footer_payload_bytes =
241
241
footer_compression_codec. decompress ( footer_payload_bytes. into ( ) ) ?;
242
242
243
- match String :: from_utf8 ( decompressed_footer_payload_bytes) {
244
- Err ( src) => Err ( Error :: new (
245
- ErrorKind :: DataInvalid ,
246
- "Footer is not a valid UTF-8 string" ,
247
- )
248
- . with_source ( src) ) ,
249
- Ok ( str) => Ok ( str) ,
250
- }
243
+ String :: from_utf8 ( decompressed_footer_payload_bytes) . map_err ( |src| {
244
+ Error :: new ( ErrorKind :: DataInvalid , "Footer is not a valid UTF-8 string" )
245
+ . with_source ( src)
246
+ } )
251
247
}
252
248
253
249
fn from_json_str ( string : & str ) -> Result < FileMetadata > {
254
- match serde_json:: from_str :: < FileMetadata > ( string) {
255
- Ok ( file_metadata) => Ok ( file_metadata) ,
256
- Err ( src) => Err (
257
- Error :: new ( ErrorKind :: DataInvalid , "Given string is not valid JSON" )
258
- . with_source ( src) ,
259
- ) ,
260
- }
250
+ serde_json:: from_str :: < FileMetadata > ( string) . map_err ( |src| {
251
+ Error :: new ( ErrorKind :: DataInvalid , "Given string is not valid JSON" ) . with_source ( src)
252
+ } )
261
253
}
262
254
263
255
/// Returns the file metadata about a Puffin file
You can’t perform that action at this time.
0 commit comments