From a28483f3d1221259eacd6a03b87f6a00525f14d7 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Sat, 8 Feb 2025 00:01:18 +0100 Subject: [PATCH] fix: avoid searching for icons that previously could not be found Causes significant CPU usage in some areas --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7469d1d..02854cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -288,8 +288,10 @@ impl<'a> LookupBuilder<'a> { // If the icon was previously search but not found, we return // `None` early, otherwise, attempt to perform a lookup if self.cache { - if let CacheEntry::Found(icon) = self.cache_lookup(self.theme) { - return Some(icon); + match self.cache_lookup(self.theme) { + CacheEntry::Found(icon) => return Some(icon), + CacheEntry::NotFound => return None, + _ => () } }