Skip to content

Commit

Permalink
frequency: replace foreach with regular for; remove unneeded assert
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Dec 2, 2022
1 parent 07ebdda commit 74eb321
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/cmd/frequency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ impl Args {

let pool = ThreadPool::new(util::njobs(self.flag_jobs));
let (send, recv) = channel::bounded(0);
(0..nchunks).for_each(|i| {
for i in 0..nchunks {
let (send, args, sel) = (send.clone(), self.clone(), sel.clone());
pool.execute(move || {
let mut idx = args.rconfig().indexed().unwrap().unwrap();
idx.seek((i * chunk_size) as u64).unwrap();
let it = idx.byte_records().take(chunk_size);
send.send(args.ftables(&sel, it).unwrap()).unwrap();
});
});
}
drop(send);
Ok((headers, merge_all(recv.iter()).unwrap()))
}
Expand Down
3 changes: 0 additions & 3 deletions tests/test_frequency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,5 @@ fn assert_eq_ftables(got: &FTables, expected: &FTables) -> bool {
for (k, v) in got.iter() {
assert_eq!(freq_data(v), freq_data(expected.get(k).unwrap()));
}
for (k, v) in expected.iter() {
assert_eq!(freq_data(got.get(k).unwrap()), freq_data(v));
}
true
}

0 comments on commit 74eb321

Please sign in to comment.