mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
ModuleDef is Def-free
This commit is contained in:
parent
0f2f3a21e7
commit
ff9c5bef7b
4 changed files with 2 additions and 12 deletions
|
@ -5,7 +5,7 @@ use ra_db::{CrateId, FileId};
|
||||||
use ra_syntax::{ast::self, TreeArc, SyntaxNode};
|
use ra_syntax::{ast::self, TreeArc, SyntaxNode};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Name, DefId, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId,
|
Name, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId,
|
||||||
type_ref::TypeRef,
|
type_ref::TypeRef,
|
||||||
nameres::{ModuleScope, lower::ImportId},
|
nameres::{ModuleScope, lower::ImportId},
|
||||||
db::HirDatabase,
|
db::HirDatabase,
|
||||||
|
@ -62,13 +62,12 @@ pub enum ModuleDef {
|
||||||
Function(Function),
|
Function(Function),
|
||||||
Struct(Struct),
|
Struct(Struct),
|
||||||
Enum(Enum),
|
Enum(Enum),
|
||||||
|
// Can't be directly declared, but can be imported.
|
||||||
EnumVariant(EnumVariant),
|
EnumVariant(EnumVariant),
|
||||||
Const(Const),
|
Const(Const),
|
||||||
Static(Static),
|
Static(Static),
|
||||||
Trait(Trait),
|
Trait(Trait),
|
||||||
Type(Type),
|
Type(Type),
|
||||||
// Can't be directly declared, but can be imported.
|
|
||||||
Def(DefId),
|
|
||||||
}
|
}
|
||||||
impl_froms!(
|
impl_froms!(
|
||||||
ModuleDef: Module,
|
ModuleDef: Module,
|
||||||
|
@ -82,12 +81,6 @@ impl_froms!(
|
||||||
Type
|
Type
|
||||||
);
|
);
|
||||||
|
|
||||||
impl From<DefId> for ModuleDef {
|
|
||||||
fn from(it: DefId) -> ModuleDef {
|
|
||||||
ModuleDef::Def(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum ModuleSource {
|
pub enum ModuleSource {
|
||||||
SourceFile(TreeArc<ast::SourceFile>),
|
SourceFile(TreeArc<ast::SourceFile>),
|
||||||
Module(TreeArc<ast::Module>),
|
Module(TreeArc<ast::Module>),
|
||||||
|
|
|
@ -695,7 +695,6 @@ impl From<ModuleDef> for Option<TypableDef> {
|
||||||
ModuleDef::EnumVariant(v) => v.into(),
|
ModuleDef::EnumVariant(v) => v.into(),
|
||||||
ModuleDef::Const(_)
|
ModuleDef::Const(_)
|
||||||
| ModuleDef::Static(_)
|
| ModuleDef::Static(_)
|
||||||
| ModuleDef::Def(_)
|
|
||||||
| ModuleDef::Module(_)
|
| ModuleDef::Module(_)
|
||||||
| ModuleDef::Trait(_)
|
| ModuleDef::Trait(_)
|
||||||
| ModuleDef::Type(_) => return None,
|
| ModuleDef::Type(_) => return None,
|
||||||
|
|
|
@ -227,7 +227,6 @@ impl Builder {
|
||||||
hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)),
|
hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)),
|
||||||
hir::ModuleDef::Trait(it) => (CompletionItemKind::Trait, 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::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)),
|
||||||
hir::ModuleDef::Def(_) => return self,
|
|
||||||
};
|
};
|
||||||
self.kind = Some(kind);
|
self.kind = Some(kind);
|
||||||
self.documentation = docs;
|
self.documentation = docs;
|
||||||
|
|
|
@ -107,7 +107,6 @@ impl NavigationTarget {
|
||||||
module_def: hir::ModuleDef,
|
module_def: hir::ModuleDef,
|
||||||
) -> Option<NavigationTarget> {
|
) -> Option<NavigationTarget> {
|
||||||
match module_def {
|
match module_def {
|
||||||
hir::ModuleDef::Def(_) => return None,
|
|
||||||
hir::ModuleDef::Module(module) => Some(NavigationTarget::from_module(db, module)),
|
hir::ModuleDef::Module(module) => Some(NavigationTarget::from_module(db, module)),
|
||||||
hir::ModuleDef::Function(func) => Some(NavigationTarget::from_function(db, func)),
|
hir::ModuleDef::Function(func) => Some(NavigationTarget::from_function(db, func)),
|
||||||
hir::ModuleDef::Struct(s) => {
|
hir::ModuleDef::Struct(s) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue