mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
fix: Fix status command panicking when additional LRU caches are set up
This commit is contained in:
parent
d1ca505525
commit
e8f5d7620f
1 changed files with 5 additions and 5 deletions
|
@ -227,10 +227,11 @@ impl fmt::Display for SymbolsStats<SourceRootId> {
|
||||||
}
|
}
|
||||||
impl<Key> StatCollect<Key, Arc<SymbolIndex>> for SymbolsStats<Key> {
|
impl<Key> StatCollect<Key, Arc<SymbolIndex>> for SymbolsStats<Key> {
|
||||||
fn collect_entry(&mut self, _: Key, value: Option<Arc<SymbolIndex>>) {
|
fn collect_entry(&mut self, _: Key, value: Option<Arc<SymbolIndex>>) {
|
||||||
let symbols = value.unwrap();
|
if let Some(symbols) = value {
|
||||||
self.total += symbols.len();
|
self.total += symbols.len();
|
||||||
self.size += symbols.memory_size();
|
self.size += symbols.memory_size();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
@ -254,8 +255,7 @@ impl fmt::Display for AttrsStats {
|
||||||
|
|
||||||
impl<Key> StatCollect<Key, Attrs> for AttrsStats {
|
impl<Key> StatCollect<Key, Attrs> for AttrsStats {
|
||||||
fn collect_entry(&mut self, _: Key, value: Option<Attrs>) {
|
fn collect_entry(&mut self, _: Key, value: Option<Attrs>) {
|
||||||
let attrs = value.unwrap();
|
|
||||||
self.entries += 1;
|
self.entries += 1;
|
||||||
self.total += attrs.len();
|
self.total += value.map_or(0, |it| it.len());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue