mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Fix an awful bug in LRUCache::touch().
MozReview-Commit-ID: 3l7L0MfdOxh
This commit is contained in:
parent
db67cd1759
commit
c409c2089c
1 changed files with 1 additions and 2 deletions
|
@ -39,8 +39,7 @@ impl<K: Array> LRUCache<K> {
|
|||
#[inline]
|
||||
/// Touch a given entry, putting it first in the list.
|
||||
pub fn touch(&mut self, pos: usize) {
|
||||
let last_index = self.entries.len() - 1;
|
||||
if pos != last_index {
|
||||
if pos != 0 {
|
||||
let entry = self.entries.remove(pos).unwrap();
|
||||
self.entries.push_front(entry);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue