mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-11 12:48:47 +00:00
hide empty changes
This commit is contained in:
parent
9de3a45be6
commit
e086cc8db5
2 changed files with 20 additions and 7 deletions
|
@ -72,13 +72,23 @@ struct RemoveFile {
|
|||
|
||||
impl fmt::Debug for AnalysisChange {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("AnalysisChange")
|
||||
.field("new_roots", &self.new_roots)
|
||||
.field("roots_changed", &self.roots_changed)
|
||||
.field("files_changed", &self.files_changed.len())
|
||||
.field("libraries_added", &self.libraries_added.len())
|
||||
.field("crate_graph", &self.crate_graph)
|
||||
.finish()
|
||||
let mut d = fmt.debug_struct("AnalysisChange");
|
||||
if !self.new_roots.is_empty() {
|
||||
d.field("new_roots", &self.new_roots);
|
||||
}
|
||||
if !self.roots_changed.is_empty() {
|
||||
d.field("roots_changed", &self.roots_changed);
|
||||
}
|
||||
if !self.files_changed.is_empty() {
|
||||
d.field("files_changed", &self.files_changed.len());
|
||||
}
|
||||
if !self.libraries_added.is_empty() {
|
||||
d.field("libraries_added", &self.libraries_added.len());
|
||||
}
|
||||
if !self.crate_graph.is_some() {
|
||||
d.field("crate_graph", &self.crate_graph);
|
||||
}
|
||||
d.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@ impl CrateGraph {
|
|||
pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) {
|
||||
self.arena.get_mut(&from).unwrap().add_dep(name, to)
|
||||
}
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.arena.is_empty()
|
||||
}
|
||||
pub fn crate_root(&self, crate_id: CrateId) -> FileId {
|
||||
self.arena[&crate_id].file_id
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue