@@ -21,17 +21,13 @@ use crate::{
2121} ;
2222
2323/// Unpacks an ar archive into the given output folder
24- pub fn unpack_archive (
25- reader : Box < dyn Read > ,
26- output_folder : & Path ,
27- ) -> crate :: Result < Unpacked > {
24+ pub fn unpack_archive ( reader : Box < dyn Read > , output_folder : & Path ) -> crate :: Result < Unpacked > {
2825 let mut archive = ar:: Archive :: new ( reader) ;
2926 let mut files_unpacked = 0 ;
3027
3128 while let Some ( entry_result) = archive. next_entry ( ) {
3229 let mut entry = entry_result. map_err ( |e| {
33- FinalError :: with_title ( "Failed to read ar archive" )
34- . detail ( format ! ( "Error reading ar entry: {e}" ) )
30+ FinalError :: with_title ( "Failed to read ar archive" ) . detail ( format ! ( "Error reading ar entry: {e}" ) )
3531 } ) ?;
3632
3733 let identifier = String :: from_utf8_lossy ( entry. header ( ) . identifier ( ) )
@@ -70,9 +66,7 @@ pub fn unpack_archive(
7066}
7167
7268/// List contents of an ar archive
73- pub fn list_archive < R : Read + Send + ' static > (
74- reader : R ,
75- ) -> impl Iterator < Item = crate :: Result < FileInArchive > > {
69+ pub fn list_archive < R : Read + Send + ' static > ( reader : R ) -> impl Iterator < Item = crate :: Result < FileInArchive > > {
7670 struct Files ( Receiver < crate :: Result < FileInArchive > > ) ;
7771 impl Iterator for Files {
7872 type Item = crate :: Result < FileInArchive > ;
@@ -180,10 +174,12 @@ where
180174 // ar crate requires std::fs::File, so we get the inner file
181175 let mut std_file = file. into_parts ( ) . 0 ;
182176
183- builder. append_file ( file_name. as_bytes ( ) , & mut std_file) . map_err ( |err| {
184- FinalError :: with_title ( "Could not create ar archive" )
185- . detail ( format ! ( "Error adding file '{}': {err}" , path. display( ) ) )
186- } ) ?;
177+ builder
178+ . append_file ( file_name. as_bytes ( ) , & mut std_file)
179+ . map_err ( |err| {
180+ FinalError :: with_title ( "Could not create ar archive" )
181+ . detail ( format ! ( "Error adding file '{}': {err}" , path. display( ) ) )
182+ } ) ?;
187183 }
188184 env:: set_current_dir ( previous_location) ?;
189185 }
0 commit comments