about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-25 08:42:25 +0000
committerbors <bors@rust-lang.org>2023-04-25 08:42:25 +0000
commit6f10ddc1223dc0f7b4cb8979055dfc4744dbfac0 (patch)
tree8a26086ea589e2cd0186cd7f443a441f21d3bf24
parent707382c21dff9f7a00dc91fadbd1363838b7d71b (diff)
parente8f5d7620ff530a4c088dc757af21f4371040af1 (diff)
downloadrust-6f10ddc1223dc0f7b4cb8979055dfc4744dbfac0.tar.gz
rust-6f10ddc1223dc0f7b4cb8979055dfc4744dbfac0.zip
Auto merge of #14654 - Veykril:status-fix, r=Veykril
fix: Fix status command panicking when additional LRU caches are set up
-rw-r--r--crates/ide/src/status.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs
index 0597302ca84..3dfbc1874b3 100644
--- a/crates/ide/src/status.rs
+++ b/crates/ide/src/status.rs
@@ -227,9 +227,10 @@ impl fmt::Display for SymbolsStats<SourceRootId> {
 }
 impl<Key> StatCollect<Key, Arc<SymbolIndex>> for SymbolsStats<Key> {
     fn collect_entry(&mut self, _: Key, value: Option<Arc<SymbolIndex>>) {
-        let symbols = value.unwrap();
-        self.total += symbols.len();
-        self.size += symbols.memory_size();
+        if let Some(symbols) = value {
+            self.total += symbols.len();
+            self.size += symbols.memory_size();
+        }
     }
 }
 
@@ -254,8 +255,7 @@ impl fmt::Display for AttrsStats {
 
 impl<Key> StatCollect<Key, Attrs> for AttrsStats {
     fn collect_entry(&mut self, _: Key, value: Option<Attrs>) {
-        let attrs = value.unwrap();
         self.entries += 1;
-        self.total += attrs.len();
+        self.total += value.map_or(0, |it| it.len());
     }
 }