diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2017-09-11 16:12:32 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2017-09-11 22:39:33 -0700 |
commit | c409c2089c3686d2a6a25b21eb27cef052faf421 (patch) | |
tree | 2fa90e28a3c14def97b87d433f1100eefad568da | |
parent | db67cd1759084c10b4ab54f050a21962947975f6 (diff) | |
download | servo-c409c2089c3686d2a6a25b21eb27cef052faf421.tar.gz servo-c409c2089c3686d2a6a25b21eb27cef052faf421.zip |
Fix an awful bug in LRUCache::touch().
MozReview-Commit-ID: 3l7L0MfdOxh
-rw-r--r-- | components/style/cache.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/components/style/cache.rs b/components/style/cache.rs index 8e4c7371938..013c267c165 100644 --- a/components/style/cache.rs +++ b/components/style/cache.rs @@ -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); } |