Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6f10ddc

Browse files
committed
Auto merge of rust-lang#14654 - Veykril:status-fix, r=Veykril
fix: Fix status command panicking when additional LRU caches are set up
2 parents 707382c + e8f5d76 commit 6f10ddc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/ide/src/status.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,10 @@ impl fmt::Display for SymbolsStats<SourceRootId> {
227227
}
228228
impl<Key> StatCollect<Key, Arc<SymbolIndex>> for SymbolsStats<Key> {
229229
fn collect_entry(&mut self, _: Key, value: Option<Arc<SymbolIndex>>) {
230-
let symbols = value.unwrap();
231-
self.total += symbols.len();
232-
self.size += symbols.memory_size();
230+
if let Some(symbols) = value {
231+
self.total += symbols.len();
232+
self.size += symbols.memory_size();
233+
}
233234
}
234235
}
235236

@@ -254,8 +255,7 @@ impl fmt::Display for AttrsStats {
254255

255256
impl<Key> StatCollect<Key, Attrs> for AttrsStats {
256257
fn collect_entry(&mut self, _: Key, value: Option<Attrs>) {
257-
let attrs = value.unwrap();
258258
self.entries += 1;
259-
self.total += attrs.len();
259+
self.total += value.map_or(0, |it| it.len());
260260
}
261261
}

0 commit comments

Comments
 (0)