From d1d0b5a88c666048c21fd225a08170fcc06060e5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 18 Jun 2020 08:29:34 +0200 Subject: Remove special casing for library symbols We might as well handle them internally, via queries. I am not sure, but it looks like the current LibraryData setup might even predate salsa? It's not really needed and creates a bunch of complexity. --- crates/ra_ide/src/lib.rs | 2 +- crates/ra_ide/src/status.rs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 375da1f45..51dc1f041 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -82,7 +82,7 @@ pub use ra_db::{ Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, }; pub use ra_ide_db::{ - change::{AnalysisChange, LibraryData}, + change::AnalysisChange, line_index::{LineCol, LineIndex}, search::SearchScope, source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 5b7992920..45411b357 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs @@ -16,6 +16,7 @@ use ra_prof::{memory_usage, Bytes}; use ra_syntax::{ast, Parse, SyntaxNode}; use crate::FileId; +use rustc_hash::FxHashMap; fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { db.query(ra_db::ParseQuery).entries::() @@ -123,20 +124,24 @@ struct LibrarySymbolsStats { impl fmt::Display for LibrarySymbolsStats { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "{} ({}) symbols", self.total, self.size,) + write!(fmt, "{} ({}) symbols", self.total, self.size) } } -impl FromIterator>> for LibrarySymbolsStats { +impl FromIterator>>> + for LibrarySymbolsStats +{ fn from_iter(iter: T) -> LibrarySymbolsStats where - T: IntoIterator>>, + T: IntoIterator>>>, { let mut res = LibrarySymbolsStats::default(); for entry in iter { let value = entry.value.unwrap(); - res.total += value.len(); - res.size += value.memory_size(); + for symbols in value.values() { + res.total += symbols.len(); + res.size += symbols.memory_size(); + } } res } -- cgit v1.2.3