fmt
This commit is contained in:
parent
80382751df
commit
7d17e904fc
15
src/main.rs
15
src/main.rs
@ -244,7 +244,6 @@ impl<T> SplitTo<T> for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn process_files(files: &&[PathBuf]) {
|
||||
if files.is_empty() {
|
||||
return;
|
||||
@ -301,16 +300,20 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// check output directory
|
||||
let out_dir: PathBuf = OUTPUT_PATH.into();
|
||||
if out_dir.is_file() {
|
||||
return Err("output directory is file!".into());
|
||||
}
|
||||
else if !out_dir.exists() {
|
||||
return Err("output directory is file!".into());
|
||||
} else if !out_dir.exists() {
|
||||
fs::create_dir_all(out_dir)?;
|
||||
};
|
||||
|
||||
println!("processing {} files with {} threads...", source_files.len(), rayon::current_num_threads());
|
||||
println!(
|
||||
"processing {} files with {} threads...",
|
||||
source_files.len(),
|
||||
rayon::current_num_threads()
|
||||
);
|
||||
|
||||
// split vector and process its parts in parallel
|
||||
source_files.split_to(rayon::current_num_threads())
|
||||
source_files
|
||||
.split_to(rayon::current_num_threads())
|
||||
.par_iter()
|
||||
.for_each(process_files);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user