From c409c2089c3686d2a6a25b21eb27cef052faf421 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 11 Sep 2017 16:12:32 -0700 Subject: [PATCH] Fix an awful bug in LRUCache::touch(). MozReview-Commit-ID: 3l7L0MfdOxh --- components/style/cache.rs | 3 +-- 1 file changed, 1 insertion(+), 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 LRUCache { #[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); }