Fix lru cache to match docs (#5995)

This commit is contained in:
Emilia Hane
2024-01-10 02:07:54 +01:00
committed by GitHub
parent 57ebe9daed
commit ee3c4ebc36

View File

@ -29,7 +29,7 @@ impl<T: Hash + Eq> LruCache<T> {
if self.inner.insert(entry) {
if self.limit.get() == self.inner.len() {
// remove the oldest element in the set
self.remove_lru();
_ = self.remove_lru();
}
return true
}
@ -40,8 +40,8 @@ impl<T: Hash + Eq> LruCache<T> {
///
/// If the `LruCache` is empty this will return None.
#[inline]
fn remove_lru(&mut self) {
self.inner.pop_front();
fn remove_lru(&mut self) -> Option<T> {
self.inner.pop_front()
}
/// Returns `true` if the set contains a value.