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.
This commit is contained in:
parent
c92b946493
commit
c38136b6bc
|
@ -762,13 +762,13 @@ mod test {
|
||||||
let s = Secp256k1::new();
|
let s = Secp256k1::new();
|
||||||
let mut set = HashSet::new();
|
let mut set = HashSet::new();
|
||||||
const COUNT : usize = 1024;
|
const COUNT : usize = 1024;
|
||||||
let count = (0..COUNT).map(|_| {
|
for _ in 0..COUNT {
|
||||||
let (_, pk) = s.generate_keypair(&mut thread_rng());
|
let (_, pk) = s.generate_keypair(&mut thread_rng());
|
||||||
let hash = hash(&pk);
|
let hash = hash(&pk);
|
||||||
assert!(!set.contains(&hash));
|
assert!(!set.contains(&hash));
|
||||||
set.insert(hash);
|
set.insert(hash);
|
||||||
}).count();
|
};
|
||||||
assert_eq!(count, COUNT);
|
assert_eq!(set.len(), COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue