aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/item_tree.rs13
-rw-r--r--crates/hir_def/src/item_tree/lower.rs2
2 files changed, 3 insertions, 12 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs
index b8d7608e7..1e5c94660 100644
--- a/crates/hir_def/src/item_tree.rs
+++ b/crates/hir_def/src/item_tree.rs
@@ -66,7 +66,7 @@ impl GenericParamsId {
66} 66}
67 67
68/// The item tree of a source file. 68/// The item tree of a source file.
69#[derive(Debug, Eq, PartialEq)] 69#[derive(Debug, Default, Eq, PartialEq)]
70pub struct ItemTree { 70pub struct ItemTree {
71 _c: Count<Self>, 71 _c: Count<Self>,
72 72
@@ -82,7 +82,7 @@ impl ItemTree {
82 let syntax = if let Some(node) = db.parse_or_expand(file_id) { 82 let syntax = if let Some(node) = db.parse_or_expand(file_id) {
83 node 83 node
84 } else { 84 } else {
85 return Arc::new(Self::empty()); 85 return Default::default();
86 }; 86 };
87 87
88 let hygiene = Hygiene::new(db.upcast(), file_id); 88 let hygiene = Hygiene::new(db.upcast(), file_id);
@@ -118,15 +118,6 @@ impl ItemTree {
118 Arc::new(item_tree) 118 Arc::new(item_tree)
119 } 119 }
120 120
121 fn empty() -> Self {
122 Self {
123 _c: Count::new(),
124 top_level: Default::default(),
125 attrs: Default::default(),
126 data: Default::default(),
127 }
128 }
129
130 fn shrink_to_fit(&mut self) { 121 fn shrink_to_fit(&mut self) {
131 if let Some(data) = &mut self.data { 122 if let Some(data) = &mut self.data {
132 let ItemTreeData { 123 let ItemTreeData {
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index ce470fc3b..8a71376b9 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -43,7 +43,7 @@ pub(super) struct Ctx {
43impl Ctx { 43impl Ctx {
44 pub(super) fn new(db: &dyn DefDatabase, hygiene: Hygiene, file: HirFileId) -> Self { 44 pub(super) fn new(db: &dyn DefDatabase, hygiene: Hygiene, file: HirFileId) -> Self {
45 Self { 45 Self {
46 tree: ItemTree::empty(), 46 tree: ItemTree::default(),
47 hygiene, 47 hygiene,
48 file, 48 file,
49 source_ast_id_map: db.ast_id_map(file), 49 source_ast_id_map: db.ast_id_map(file),