From e48430cbae32249e50dda1b39e0c98a31f118250 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 20:53:42 +0300 Subject: Simplify --- crates/ra_hir/src/code_model/src.rs | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'crates/ra_hir/src/code_model') diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs index b9d21bdd7..a0e605603 100644 --- a/crates/ra_hir/src/code_model/src.rs +++ b/crates/ra_hir/src/code_model/src.rs @@ -2,11 +2,10 @@ use hir_def::{AstItemDef, HasChildSource, HasSource as _, Lookup, VariantId}; use hir_expand::either::Either; -use ra_syntax::ast::{self, AstNode}; +use ra_syntax::ast; use crate::{ - db::{DefDatabase, HirDatabase}, - Const, Enum, EnumVariant, FieldSource, Function, HasBody, Import, MacroDef, Module, + db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, Import, MacroDef, Module, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, }; @@ -121,27 +120,3 @@ impl HasSource for Import { src.with_value(ptr.map(|it| it.to_node(&root), |it| it.to_node(&root))) } } - -pub trait HasBodySource: HasBody + HasSource -where - Self::Ast: AstNode, -{ - fn expr_source( - self, - db: &impl HirDatabase, - expr_id: crate::expr::ExprId, - ) -> Option>> { - let source_map = self.body_source_map(db); - let source_ptr = source_map.expr_syntax(expr_id)?; - let root = source_ptr.file_syntax(db); - let source = source_ptr.map(|ast| ast.map(|it| it.to_node(&root), |it| it.to_node(&root))); - Some(source) - } -} - -impl HasBodySource for T -where - T: HasBody + HasSource, - T::Ast: AstNode, -{ -} -- cgit v1.2.3