diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-07-26 23:19:31 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-07-26 23:19:31 +0200 |
| commit | 5dbb856a0c036d9e770400c02e8c719be1075527 (patch) | |
| tree | c7ab72f022e59832f245c49f4798983751bf1a8c /src/index.rs | |
| parent | 6c7935ff4589adc92459185f3e9d1f47c76af1ed (diff) | |
remove filecounter
Diffstat (limited to 'src/index.rs')
| -rw-r--r-- | src/index.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/index.rs b/src/index.rs index 92a12b6..332dece 100644 --- a/src/index.rs +++ b/src/index.rs @@ -41,7 +41,6 @@ impl Index { } pub fn generate(input_path : &str, callback : impl Fn(GenState, u8)) -> Self { - let mut nof : usize = 0; let num_threads = thread::available_parallelism().unwrap().get(); let mut paths = Vec::new(); let (result_tx, result_rx) = std::sync::mpsc::channel(); @@ -49,14 +48,14 @@ impl Index { callback(GenState::Fetching, 0); for entry in WalkDir::new(input_path) .into_iter() - .filter_map(|e| e.ok()) { - if entry.path().is_file() && text::is_supported(entry.path().to_str().unwrap()) { - nof += 1; - paths.push(entry.path().to_str().unwrap().to_string()); - } + .filter_map(|e| e.ok()) { + if entry.path().is_file() && text::is_supported(entry.path().to_str().unwrap()) { + paths.push(entry.path().to_str().unwrap().to_string()); } + } callback(GenState::Fetching, 100); + let nof = paths.len(); let chunks = paths.chunks(paths.len() / num_threads); let mut filecache = Vec::with_capacity(nof); |