mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
6a728712f9
commit
ce4d442941
6 changed files with 7 additions and 16 deletions
|
@ -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(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue