From d095d9273eb2c03d1c28e0122c21fccf4099660e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 29 Oct 2019 15:22:20 +0300 Subject: remove unused query --- crates/ra_hir_expand/src/db.rs | 15 ++------------- crates/ra_hir_expand/src/lib.rs | 5 +++-- 2 files changed, 5 insertions(+), 15 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index 12aa7ad0e..8b92d4c1f 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs @@ -6,16 +6,14 @@ use ra_prof::profile; use ra_syntax::{AstNode, Parse, SyntaxNode}; use crate::{ - ast_id_map::{AstIdMap, ErasedFileAstId}, - HirFileId, HirFileIdRepr, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, MacroFileKind, + ast_id_map::AstIdMap, HirFileId, HirFileIdRepr, MacroCallId, MacroCallLoc, MacroDefId, + MacroFile, MacroFileKind, }; // FIXME: rename to ExpandDatabase #[salsa::query_group(AstDatabaseStorage)] pub trait AstDatabase: SourceDatabase { fn ast_id_map(&self, file_id: HirFileId) -> Arc; - #[salsa::transparent] - fn ast_id_to_node(&self, file_id: HirFileId, ast_id: ErasedFileAstId) -> SyntaxNode; #[salsa::transparent] fn parse_or_expand(&self, file_id: HirFileId) -> Option; @@ -34,15 +32,6 @@ pub(crate) fn ast_id_map(db: &impl AstDatabase, file_id: HirFileId) -> Arc SyntaxNode { - let node = db.parse_or_expand(file_id).unwrap(); - db.ast_id_map(file_id)[ast_id].to_node(&node) -} - pub(crate) fn macro_def(db: &impl AstDatabase, id: MacroDefId) -> Option> { let macro_call = id.ast_id.to_node(db); let arg = macro_call.token_tree()?; diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 002a5b45a..1fb124374 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -171,7 +171,8 @@ impl AstId { } pub fn to_node(&self, db: &impl AstDatabase) -> N { - let syntax_node = db.ast_id_to_node(self.file_id, self.file_ast_id.into()); - N::cast(syntax_node).unwrap() + let root = db.parse_or_expand(self.file_id).unwrap(); + let node = db.ast_id_map(self.file_id)[self.file_ast_id.into()].to_node(&root); + N::cast(node).unwrap() } } -- cgit v1.2.3