diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 22:32:47 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 22:32:47 +0000 |
commit | ff9c5bef7b198cde4358610c565cd0b6dc466de5 (patch) | |
tree | 826b309ec9210c03c99534931ba70e6fc715d69e | |
parent | 0f2f3a21e7e624f920d182869896347af309e909 (diff) |
ModuleDef is Def-free
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir/src/ty.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 1 |
4 files changed, 2 insertions, 12 deletions
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}; | |||
5 | use ra_syntax::{ast::self, TreeArc, SyntaxNode}; | 5 | use ra_syntax::{ast::self, TreeArc, SyntaxNode}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | Name, DefId, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId, | 8 | Name, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId, |
9 | type_ref::TypeRef, | 9 | type_ref::TypeRef, |
10 | nameres::{ModuleScope, lower::ImportId}, | 10 | nameres::{ModuleScope, lower::ImportId}, |
11 | db::HirDatabase, | 11 | db::HirDatabase, |
@@ -62,13 +62,12 @@ pub enum ModuleDef { | |||
62 | Function(Function), | 62 | Function(Function), |
63 | Struct(Struct), | 63 | Struct(Struct), |
64 | Enum(Enum), | 64 | Enum(Enum), |
65 | // Can't be directly declared, but can be imported. | ||
65 | EnumVariant(EnumVariant), | 66 | EnumVariant(EnumVariant), |
66 | Const(Const), | 67 | Const(Const), |
67 | Static(Static), | 68 | Static(Static), |
68 | Trait(Trait), | 69 | Trait(Trait), |
69 | Type(Type), | 70 | Type(Type), |
70 | // Can't be directly declared, but can be imported. | ||
71 | Def(DefId), | ||
72 | } | 71 | } |
73 | impl_froms!( | 72 | impl_froms!( |
74 | ModuleDef: Module, | 73 | ModuleDef: Module, |
@@ -82,12 +81,6 @@ impl_froms!( | |||
82 | Type | 81 | Type |
83 | ); | 82 | ); |
84 | 83 | ||
85 | impl From<DefId> for ModuleDef { | ||
86 | fn from(it: DefId) -> ModuleDef { | ||
87 | ModuleDef::Def(it) | ||
88 | } | ||
89 | } | ||
90 | |||
91 | pub enum ModuleSource { | 84 | pub enum ModuleSource { |
92 | SourceFile(TreeArc<ast::SourceFile>), | 85 | SourceFile(TreeArc<ast::SourceFile>), |
93 | Module(TreeArc<ast::Module>), | 86 | Module(TreeArc<ast::Module>), |
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<ModuleDef> for Option<TypableDef> { | |||
695 | ModuleDef::EnumVariant(v) => v.into(), | 695 | ModuleDef::EnumVariant(v) => v.into(), |
696 | ModuleDef::Const(_) | 696 | ModuleDef::Const(_) |
697 | | ModuleDef::Static(_) | 697 | | ModuleDef::Static(_) |
698 | | ModuleDef::Def(_) | ||
699 | | ModuleDef::Module(_) | 698 | | ModuleDef::Module(_) |
700 | | ModuleDef::Trait(_) | 699 | | ModuleDef::Trait(_) |
701 | | ModuleDef::Type(_) => return None, | 700 | | 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 { | |||
227 | hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)), | 227 | hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)), |
228 | hir::ModuleDef::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), | 228 | hir::ModuleDef::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), |
229 | hir::ModuleDef::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), | 229 | hir::ModuleDef::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), |
230 | hir::ModuleDef::Def(_) => return self, | ||
231 | }; | 230 | }; |
232 | self.kind = Some(kind); | 231 | self.kind = Some(kind); |
233 | self.documentation = docs; | 232 | 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 { | |||
107 | module_def: hir::ModuleDef, | 107 | module_def: hir::ModuleDef, |
108 | ) -> Option<NavigationTarget> { | 108 | ) -> Option<NavigationTarget> { |
109 | match module_def { | 109 | match module_def { |
110 | hir::ModuleDef::Def(_) => return None, | ||
111 | hir::ModuleDef::Module(module) => Some(NavigationTarget::from_module(db, module)), | 110 | hir::ModuleDef::Module(module) => Some(NavigationTarget::from_module(db, module)), |
112 | hir::ModuleDef::Function(func) => Some(NavigationTarget::from_function(db, func)), | 111 | hir::ModuleDef::Function(func) => Some(NavigationTarget::from_function(db, func)), |
113 | hir::ModuleDef::Struct(s) => { | 112 | hir::ModuleDef::Struct(s) => { |