diff --git a/src/main.rs b/src/main.rs index 57f19db..f754e59 100644 --- a/src/main.rs +++ b/src/main.rs @@ -219,7 +219,7 @@ fn split_vec<'a, T>(src: &'a [T], num: usize) -> Vec<&'a [T]> { result } -fn process_files(files: Vec) { +fn process_files(files: &&[PathBuf]) { let zip_file = fs::File::open(BASE_FILENAME).unwrap(); let zip_reader = io::BufReader::new(zip_file); let mut archive = zip::ZipArchive::new(zip_reader).unwrap(); @@ -264,13 +264,9 @@ fn main() -> Result<(), Box> { .collect(); drop(archive); - //split vector and iterate on it parts in parallel + // split vector and process its parts in parallel split_vec(&source_files, rayon::current_num_threads()) .par_iter() - .for_each(|slice| { - let source_files_part = slice.to_vec(); - process_files(source_files_part); - }); - + .for_each(process_files); Ok(()) }