Move away from the repeat().take().collect() pattern.

This was the preferred pattern between the deprecation of Vec::from_elem and
the addition of the count argument to the vec![] macro.
This commit is contained in:
Ms2ger 2015-07-14 16:19:29 +02:00
parent 6a728712f9
commit ce4d442941
6 changed files with 7 additions and 16 deletions

View file

@ -7,7 +7,6 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_state::DefaultState;
use rand::Rng;
use std::hash::{Hash, Hasher, SipHasher};
use std::iter::repeat;
use rand;
use std::slice::Iter;
use std::default::Default;
@ -121,7 +120,7 @@ impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> {
pub fn new(cache_size: usize) -> SimpleHashCache<K,V> {
let mut r = rand::thread_rng();
SimpleHashCache {
entries: repeat(None).take(cache_size).collect(),
entries: vec![None; cache_size],
k0: r.gen(),
k1: r.gen(),
}