From 0aece75cdd40daa4d48484103cfcd36ba13ba076 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Apr 2020 19:25:33 +0200 Subject: Remove dead code --- crates/ra_hir_def/src/body.rs | 8 ++++---- crates/ra_hir_def/src/body/lower.rs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir_def/src') 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; use either::Either; use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; use ra_arena::{map::ArenaMap, Arena}; +use ra_cfg::CfgOptions; +use ra_db::CrateId; use ra_prof::profile; use ra_syntax::{ast, AstNode, AstPtr}; use rustc_hash::FxHashMap; @@ -24,8 +26,6 @@ use crate::{ src::HasSource, AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, }; -use ra_cfg::CfgOptions; -use ra_db::CrateId; /// A subser of Exander that only deals with cfg attributes. We only need it to /// avoid cyclic queries in crate def map during enum processing. @@ -187,7 +187,7 @@ pub struct Body { pub item_scope: ItemScope, } -pub type ExprPtr = Either, AstPtr>; +pub type ExprPtr = AstPtr; pub type ExprSource = InFile; pub type PatPtr = Either, AstPtr>; @@ -285,7 +285,7 @@ impl BodySourceMap { } pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option { - let src = node.map(|it| Either::Left(AstPtr::new(it))); + let src = node.map(|it| AstPtr::new(it)); self.expr_map.get(&src).cloned() } 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<'_> { } fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr) -> ExprId { - let ptr = Either::Left(ptr); let src = self.expander.to_source(ptr); let id = self.make_expr(expr, Ok(src.clone())); self.source_map.expr_map.insert(src, id); @@ -281,7 +280,7 @@ impl ExprCollector<'_> { ast::Expr::ParenExpr(e) => { let inner = self.collect_expr_opt(e.expr()); // make the paren expr point to the inner expression as well - let src = self.expander.to_source(Either::Left(syntax_ptr)); + let src = self.expander.to_source(syntax_ptr); self.source_map.expr_map.insert(src, inner); inner } -- cgit v1.2.3