Auto merge of #14654 - Veykril:status-fix, r=Veykril

fix: Fix status command panicking when additional LRU caches are set up
This commit is contained in:
bors 2023-04-25 08:42:25 +00:00
commit 6f10ddc122

View File

@ -227,9 +227,10 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
}
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 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
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());
}
}