From 94241cec04f0dfa4aa725f114abc0405f65b00b9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 22 Dec 2018 11:57:42 +0300 Subject: less verbose debug for library data --- crates/ra_analysis/src/lib.rs | 11 ++++++++++- crates/ra_analysis/src/symbol_index.rs | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 6fd157880..85df9c089 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -368,13 +368,22 @@ impl Analysis { } } -#[derive(Debug)] pub struct LibraryData { root_id: SourceRootId, root_change: RootChange, symbol_index: SymbolIndex, } +impl fmt::Debug for LibraryData { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("LibraryData") + .field("root_id", &self.root_id) + .field("root_change", &self.root_change) + .field("n_symbols", &self.symbol_index.len()) + .finish() + } +} + impl LibraryData { pub fn prepare( root_id: SourceRootId, diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs index b48a37229..e5bdf0aa1 100644 --- a/crates/ra_analysis/src/symbol_index.rs +++ b/crates/ra_analysis/src/symbol_index.rs @@ -56,6 +56,10 @@ impl Hash for SymbolIndex { } impl SymbolIndex { + pub(crate) fn len(&self) -> usize { + self.symbols.len() + } + pub(crate) fn for_files( files: impl ParallelIterator, ) -> SymbolIndex { -- cgit v1.2.3