aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-11 18:25:33 +0100
committerAleksey Kladov <[email protected]>2020-04-11 18:36:31 +0100
commit0aece75cdd40daa4d48484103cfcd36ba13ba076 (patch)
tree6cfd504aa174c971242f5f0d16e8d0a7ff216ba2 /crates/ra_hir_def
parent7a39bc3ba29351feabcd4a16e12568a9e12818ca (diff)
Remove dead code
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/body.rs8
-rw-r--r--crates/ra_hir_def/src/body/lower.rs3
2 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 67d623714..eafaf48c1 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -9,6 +9,8 @@ use drop_bomb::DropBomb;
9use either::Either; 9use either::Either;
10use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; 10use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId};
11use ra_arena::{map::ArenaMap, Arena}; 11use ra_arena::{map::ArenaMap, Arena};
12use ra_cfg::CfgOptions;
13use ra_db::CrateId;
12use ra_prof::profile; 14use ra_prof::profile;
13use ra_syntax::{ast, AstNode, AstPtr}; 15use ra_syntax::{ast, AstNode, AstPtr};
14use rustc_hash::FxHashMap; 16use rustc_hash::FxHashMap;
@@ -24,8 +26,6 @@ use crate::{
24 src::HasSource, 26 src::HasSource,
25 AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, 27 AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId,
26}; 28};
27use ra_cfg::CfgOptions;
28use ra_db::CrateId;
29 29
30/// A subser of Exander that only deals with cfg attributes. We only need it to 30/// A subser of Exander that only deals with cfg attributes. We only need it to
31/// avoid cyclic queries in crate def map during enum processing. 31/// avoid cyclic queries in crate def map during enum processing.
@@ -187,7 +187,7 @@ pub struct Body {
187 pub item_scope: ItemScope, 187 pub item_scope: ItemScope,
188} 188}
189 189
190pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; 190pub type ExprPtr = AstPtr<ast::Expr>;
191pub type ExprSource = InFile<ExprPtr>; 191pub type ExprSource = InFile<ExprPtr>;
192 192
193pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; 193pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>;
@@ -285,7 +285,7 @@ impl BodySourceMap {
285 } 285 }
286 286
287 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { 287 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> {
288 let src = node.map(|it| Either::Left(AstPtr::new(it))); 288 let src = node.map(|it| AstPtr::new(it));
289 self.expr_map.get(&src).cloned() 289 self.expr_map.get(&src).cloned()
290 } 290 }
291 291
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 990761661..cc2532e88 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -101,7 +101,6 @@ impl ExprCollector<'_> {
101 } 101 }
102 102
103 fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { 103 fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId {
104 let ptr = Either::Left(ptr);
105 let src = self.expander.to_source(ptr); 104 let src = self.expander.to_source(ptr);
106 let id = self.make_expr(expr, Ok(src.clone())); 105 let id = self.make_expr(expr, Ok(src.clone()));
107 self.source_map.expr_map.insert(src, id); 106 self.source_map.expr_map.insert(src, id);
@@ -281,7 +280,7 @@ impl ExprCollector<'_> {
281 ast::Expr::ParenExpr(e) => { 280 ast::Expr::ParenExpr(e) => {
282 let inner = self.collect_expr_opt(e.expr()); 281 let inner = self.collect_expr_opt(e.expr());
283 // make the paren expr point to the inner expression as well 282 // make the paren expr point to the inner expression as well
284 let src = self.expander.to_source(Either::Left(syntax_ptr)); 283 let src = self.expander.to_source(syntax_ptr);
285 self.source_map.expr_map.insert(src, inner); 284 self.source_map.expr_map.insert(src, inner);
286 inner 285 inner
287 } 286 }