diff --git a/src/lib.rs b/src/lib.rs index 0c45c6b..78c4347 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -86,13 +86,12 @@ impl Default for LRUCache { impl LRUCache { /// Create an empty cache. pub const fn new() -> Self { - let cache = LRUCache { + assert!(N < u16::MAX as usize, "Capacity overflow"); + LRUCache { entries: ArrayVec::new_const(), head: 0, tail: 0, - }; - assert!(N < u16::max_value() as usize, "Capacity overflow"); - cache + } } /// Insert a given key in the cache.