Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/ast_id_map.rs')
-rw-r--r--crates/hir-expand/src/ast_id_map.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir-expand/src/ast_id_map.rs b/crates/hir-expand/src/ast_id_map.rs
index 2b27db0e95..400442de94 100644
--- a/crates/hir-expand/src/ast_id_map.rs
+++ b/crates/hir-expand/src/ast_id_map.rs
@@ -115,6 +115,7 @@ impl AstIdMap {
}
}
}
+ res.arena.shrink_to_fit();
res
}
@@ -123,6 +124,10 @@ impl AstIdMap {
FileAstId { raw, _ty: PhantomData }
}
+ pub fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> {
+ AstPtr::try_from_raw(self.arena[id.raw].clone()).unwrap()
+ }
+
fn erased_ast_id(&self, item: &SyntaxNode) -> ErasedFileAstId {
let ptr = SyntaxNodePtr::new(item);
let hash = hash_ptr(&ptr);
@@ -136,10 +141,6 @@ impl AstIdMap {
}
}
- pub fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> {
- AstPtr::try_from_raw(self.arena[id.raw].clone()).unwrap()
- }
-
fn alloc(&mut self, item: &SyntaxNode) -> ErasedFileAstId {
self.arena.alloc(SyntaxNodePtr::new(item))
}