From 6b993a97602da5ddee4033d4d76a68471f8d1ee1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Apr 2019 22:51:22 +0300 Subject: migrate to salsas interning --- crates/ra_ide_api/src/db.rs | 9 --------- crates/ra_ide_api/src/status.rs | 7 +------ 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index ea4255d35..33d3903bb 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs @@ -20,7 +20,6 @@ use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}}; #[derive(Debug)] pub(crate) struct RootDatabase { runtime: salsa::Runtime, - interner: Arc, pub(crate) last_gc: time::Instant, pub(crate) last_gc_check: time::Instant, } @@ -38,7 +37,6 @@ impl Default for RootDatabase { fn default() -> RootDatabase { let mut db = RootDatabase { runtime: salsa::Runtime::default(), - interner: Default::default(), last_gc: time::Instant::now(), last_gc_check: time::Instant::now(), }; @@ -53,19 +51,12 @@ impl salsa::ParallelDatabase for RootDatabase { fn snapshot(&self) -> salsa::Snapshot { salsa::Snapshot::new(RootDatabase { runtime: self.runtime.snapshot(self), - interner: Arc::clone(&self.interner), last_gc: self.last_gc.clone(), last_gc_check: self.last_gc_check.clone(), }) } } -impl AsRef for RootDatabase { - fn as_ref(&self) -> &hir::HirInterner { - &self.interner - } -} - #[salsa::query_group(LineIndexDatabaseStorage)] pub(crate) trait LineIndexDatabase: ra_db::SourceDatabase + CheckCanceled { fn line_index(&self, file_id: FileId) -> Arc; diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index e0fc1c123..d99a4e750 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs @@ -23,16 +23,11 @@ pub(crate) fn status(db: &RootDatabase) -> String { let files_stats = db.query(FileTextQuery).entries::(); let syntax_tree_stats = syntax_tree_stats(db); let symbols_stats = db.query(LibrarySymbolsQuery).entries::(); - let n_defs = { - let interner: &hir::HirInterner = db.as_ref(); - interner.len() - }; format!( - "{}\n{}\n{}\n{} defs\n\nmemory:\n{}\ngc {:?} seconds ago", + "{}\n{}\n{}\n\n\nmemory:\n{}\ngc {:?} seconds ago", files_stats, symbols_stats, syntax_tree_stats, - n_defs, MemoryStats::current(), db.last_gc.elapsed().as_secs(), ) -- cgit v1.2.3