Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Apr 8, 2024
1 parent 43854d3 commit c926395
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ impl<T, const N: usize> Default for LRUCache<T, N> {
impl<T, const N: usize> LRUCache<T, N> {
/// 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.
Expand Down

0 comments on commit c926395

Please sign in to comment.