From ff9c5bef7b198cde4358610c565cd0b6dc466de5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 01:32:47 +0300 Subject: ModuleDef is Def-free --- crates/ra_hir/src/code_model_api.rs | 11 ++--------- crates/ra_hir/src/ty.rs | 1 - crates/ra_ide_api/src/completion/completion_item.rs | 1 - crates/ra_ide_api/src/navigation_target.rs | 1 - 4 files changed, 2 insertions(+), 12 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index e2979617d..6739627b4 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs @@ -5,7 +5,7 @@ use ra_db::{CrateId, FileId}; use ra_syntax::{ast::self, TreeArc, SyntaxNode}; use crate::{ - Name, DefId, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId, + Name, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId, type_ref::TypeRef, nameres::{ModuleScope, lower::ImportId}, db::HirDatabase, @@ -62,13 +62,12 @@ pub enum ModuleDef { Function(Function), Struct(Struct), Enum(Enum), + // Can't be directly declared, but can be imported. EnumVariant(EnumVariant), Const(Const), Static(Static), Trait(Trait), Type(Type), - // Can't be directly declared, but can be imported. - Def(DefId), } impl_froms!( ModuleDef: Module, @@ -82,12 +81,6 @@ impl_froms!( Type ); -impl From for ModuleDef { - fn from(it: DefId) -> ModuleDef { - ModuleDef::Def(it) - } -} - pub enum ModuleSource { SourceFile(TreeArc), Module(TreeArc), diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 3801e498e..1d5624f8f 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs @@ -695,7 +695,6 @@ impl From for Option { ModuleDef::EnumVariant(v) => v.into(), ModuleDef::Const(_) | ModuleDef::Static(_) - | ModuleDef::Def(_) | ModuleDef::Module(_) | ModuleDef::Trait(_) | ModuleDef::Type(_) => return None, diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index 4e679281c..3ba6c33ee 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs @@ -227,7 +227,6 @@ impl Builder { hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)), hir::ModuleDef::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), hir::ModuleDef::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), - hir::ModuleDef::Def(_) => return self, }; self.kind = Some(kind); self.documentation = docs; diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index 2e11d2de3..c5be8e01b 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs @@ -107,7 +107,6 @@ impl NavigationTarget { module_def: hir::ModuleDef, ) -> Option { match module_def { - hir::ModuleDef::Def(_) => return None, hir::ModuleDef::Module(module) => Some(NavigationTarget::from_module(db, module)), hir::ModuleDef::Function(func) => Some(NavigationTarget::from_function(db, func)), hir::ModuleDef::Struct(s) => { -- cgit v1.2.3