diff --git a/src/data/memcache.rs b/src/data/memcache.rs index fb49191..8fd33e4 100644 --- a/src/data/memcache.rs +++ b/src/data/memcache.rs @@ -22,17 +22,12 @@ pub trait Indexable: Clone + Send { impl> MemCache { pub fn new() -> MemCache { - MemCache::with_capacity(unsafe { NonZeroUsize::new_unchecked(256) }) + MemCache::with_capacity(NonZeroUsize::new(1024).unwrap()) } pub fn with_capacity(capacity: NonZeroUsize) -> MemCache { - let capacity = capacity.get(); - let mut lines = Vec::with_capacity(capacity); - for _ in 0..capacity { - lines.push(RwLock::new(None)); - } MemCache { - lines, + lines: (0..capacity.get()).map(|_| RwLock::new(None)).collect(), _phantom: PhantomData, } }