From f596795cd24b50f048cc395866bb90a89d99152d Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 19 Apr 2024 01:40:39 +0200 Subject: [PATCH] feat: run the same formatter in parallel for many files --- src/engine.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 094079aa..a9fda025 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -123,9 +123,9 @@ pub fn run_treefmt( let start_time = Instant::now(); // Run the formatter - for path_chunks in paths.chunks(1024) { - formatter.clone().fmt(path_chunks)?; - } + paths.par_chunks(1024).try_for_each(|path_chunks| { + formatter.clone().fmt(path_chunks) + })?; // Get the new mtimes and compare them to the original ones let new_paths = paths