From b2731ab78acc7a2d38e02cd477f4a5132c1ac98b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 19 Dec 2019 18:07:39 +0100 Subject: Drop dead code --- crates/ra_hir/src/code_model.rs | 62 ++--------------------------------------- crates/ra_hir/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 60 deletions(-) diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 7850ea9a7..8dbc0d667 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -11,9 +11,9 @@ use hir_def::{ per_ns::PerNs, resolver::HasResolver, type_ref::{Mutability, TypeRef}, - AdtId, ConstId, ContainerId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, - LocalEnumVariantId, LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, - StaticId, StructId, TraitId, TypeAliasId, TypeParamId, UnionId, + AdtId, ConstId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId, + LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, + TraitId, TypeAliasId, TypeParamId, UnionId, }; use hir_expand::{ diagnostics::DiagnosticSink, @@ -529,30 +529,6 @@ impl Const { pub fn name(self, db: &impl HirDatabase) -> Option { db.const_data(self.id).name.clone() } - - /// The containing impl block, if this is a type alias. - pub fn impl_block(self, db: &impl DefDatabase) -> Option { - match self.container(db) { - Some(Container::ImplBlock(it)) => Some(it), - _ => None, - } - } - - /// The containing trait, if this is a trait type alias definition. - pub fn parent_trait(self, db: &impl DefDatabase) -> Option { - match self.container(db) { - Some(Container::Trait(it)) => Some(it), - _ => None, - } - } - - pub fn container(self, db: &impl DefDatabase) -> Option { - match self.id.lookup(db).container { - ContainerId::TraitId(it) => Some(Container::Trait(it.into())), - ContainerId::ImplId(it) => Some(Container::ImplBlock(it.into())), - ContainerId::ModuleId(_) => None, - } - } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -612,30 +588,6 @@ impl TypeAlias { Some(self.module(db).krate()) } - /// The containing impl block, if this is a type alias. - pub fn impl_block(self, db: &impl DefDatabase) -> Option { - match self.container(db) { - Some(Container::ImplBlock(it)) => Some(it), - _ => None, - } - } - - /// The containing trait, if this is a trait type alias definition. - pub fn parent_trait(self, db: &impl DefDatabase) -> Option { - match self.container(db) { - Some(Container::Trait(it)) => Some(it), - _ => None, - } - } - - pub fn container(self, db: &impl DefDatabase) -> Option { - match self.id.lookup(db).container { - ContainerId::TraitId(it) => Some(Container::Trait(it.into())), - ContainerId::ImplId(it) => Some(Container::ImplBlock(it.into())), - ContainerId::ModuleId(_) => None, - } - } - pub fn type_ref(self, db: &impl DefDatabase) -> Option { db.type_alias_data(self.id).type_ref.clone() } @@ -654,14 +606,6 @@ pub struct MacroDef { pub(crate) id: MacroDefId, } -impl MacroDef {} - -pub enum Container { - Trait(Trait), - ImplBlock(ImplBlock), -} -impl_froms!(Container: Trait, ImplBlock); - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum AssocItem { Function(Function), diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 2e52a1f5c..7f9aef770 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -39,7 +39,7 @@ mod from_source; pub use crate::{ code_model::{ - Adt, AssocItem, AttrDef, Const, Container, Crate, CrateDependency, DefWithBody, Docs, Enum, + Adt, AssocItem, AttrDef, Const, Crate, CrateDependency, DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs, ImplBlock, Import, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, -- cgit v1.2.3