diff options
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 24 | ||||
-rw-r--r-- | crates/ra_db/src/input.rs | 3 |
2 files changed, 20 insertions, 7 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 1c8aa308b..b2f4cd228 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -72,13 +72,23 @@ struct RemoveFile { | |||
72 | 72 | ||
73 | impl fmt::Debug for AnalysisChange { | 73 | impl fmt::Debug for AnalysisChange { |
74 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 74 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
75 | fmt.debug_struct("AnalysisChange") | 75 | let mut d = fmt.debug_struct("AnalysisChange"); |
76 | .field("new_roots", &self.new_roots) | 76 | if !self.new_roots.is_empty() { |
77 | .field("roots_changed", &self.roots_changed) | 77 | d.field("new_roots", &self.new_roots); |
78 | .field("files_changed", &self.files_changed.len()) | 78 | } |
79 | .field("libraries_added", &self.libraries_added.len()) | 79 | if !self.roots_changed.is_empty() { |
80 | .field("crate_graph", &self.crate_graph) | 80 | d.field("roots_changed", &self.roots_changed); |
81 | .finish() | 81 | } |
82 | if !self.files_changed.is_empty() { | ||
83 | d.field("files_changed", &self.files_changed.len()); | ||
84 | } | ||
85 | if !self.libraries_added.is_empty() { | ||
86 | d.field("libraries_added", &self.libraries_added.len()); | ||
87 | } | ||
88 | if !self.crate_graph.is_some() { | ||
89 | d.field("crate_graph", &self.crate_graph); | ||
90 | } | ||
91 | d.finish() | ||
82 | } | 92 | } |
83 | } | 93 | } |
84 | 94 | ||
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index f12dd9345..ead8dfe48 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -98,6 +98,9 @@ impl CrateGraph { | |||
98 | pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) { | 98 | pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) { |
99 | self.arena.get_mut(&from).unwrap().add_dep(name, to) | 99 | self.arena.get_mut(&from).unwrap().add_dep(name, to) |
100 | } | 100 | } |
101 | pub fn is_empty(&self) -> bool { | ||
102 | self.arena.is_empty() | ||
103 | } | ||
101 | pub fn crate_root(&self, crate_id: CrateId) -> FileId { | 104 | pub fn crate_root(&self, crate_id: CrateId) -> FileId { |
102 | self.arena[&crate_id].file_id | 105 | self.arena[&crate_id].file_id |
103 | } | 106 | } |