aboutsummaryrefslogtreecommitdiff
path: root/src/index.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.rs')
-rw-r--r--src/index.rs11
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);