Skip to content

Commit 9f6dcba

Browse files
committed
Use for loop instead of map
Currently we are misusing `map` on an iterator to loop `n` times, additionally the assertion is pointless. Use a for loop and assert against the length of the set.
1 parent cbb3e46 commit 9f6dcba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/key.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,13 @@ mod test {
762762
let s = Secp256k1::new();
763763
let mut set = HashSet::new();
764764
const COUNT : usize = 1024;
765-
let count = (0..COUNT).map(|_| {
765+
for _ in 0..COUNT {
766766
let (_, pk) = s.generate_keypair(&mut thread_rng());
767767
let hash = hash(&pk);
768768
assert!(!set.contains(&hash));
769769
set.insert(hash);
770-
}).count();
771-
assert_eq!(count, COUNT);
770+
};
771+
assert_eq!(set.len(), COUNT);
772772
}
773773

774774
#[test]

0 commit comments

Comments
 (0)