mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 05:08:52 +00:00
Remove two hir reexports
This commit is contained in:
parent
cc016df54b
commit
87f7a5849c
3 changed files with 28 additions and 23 deletions
|
@ -54,11 +54,12 @@ use hir_def::{
|
|||
per_ns::PerNs,
|
||||
resolver::{HasResolver, Resolver},
|
||||
type_ref::TypesSourceMap,
|
||||
AssocItemId, AssocItemLoc, AttrDefId, CallableDefId, ConstId, ConstParamId, CrateRootModuleId,
|
||||
DefWithBodyId, EnumId, EnumVariantId, ExternCrateId, FunctionId, GenericDefId, GenericParamId,
|
||||
HasModule, ImplId, InTypeConstId, ItemContainerId, LifetimeParamId, LocalFieldId, Lookup,
|
||||
MacroExpander, ModuleId, StaticId, StructId, SyntheticSyntax, TraitAliasId, TraitId, TupleId,
|
||||
TypeAliasId, TypeOrConstParamId, TypeParamId, UnionId,
|
||||
AdtId, AssocItemId, AssocItemLoc, AttrDefId, CallableDefId, ConstId, ConstParamId,
|
||||
CrateRootModuleId, DefWithBodyId, EnumId, EnumVariantId, ExternCrateId, FunctionId,
|
||||
GenericDefId, GenericParamId, HasModule, ImplId, InTypeConstId, ItemContainerId,
|
||||
LifetimeParamId, LocalFieldId, Lookup, MacroExpander, MacroId, ModuleId, StaticId, StructId,
|
||||
SyntheticSyntax, TraitAliasId, TraitId, TupleId, TypeAliasId, TypeOrConstParamId, TypeParamId,
|
||||
UnionId,
|
||||
};
|
||||
use hir_expand::{
|
||||
attrs::collect_attrs, proc_macro::ProcMacroKind, AstId, MacroCallKind, RenderedExpandError,
|
||||
|
@ -127,7 +128,7 @@ pub use {
|
|||
ImportPathConfig,
|
||||
// FIXME: This is here since some queries take it as input that are used
|
||||
// outside of hir.
|
||||
{AdtId, MacroId, ModuleDefId},
|
||||
ModuleDefId,
|
||||
},
|
||||
hir_expand::{
|
||||
attrs::{Attr, AttrId},
|
||||
|
@ -3000,6 +3001,10 @@ impl Macro {
|
|||
matches!(self.id, MacroId::MacroRulesId(id) if db.macro_rules_data(id).macro_export)
|
||||
}
|
||||
|
||||
pub fn is_proc_macro(self) -> bool {
|
||||
matches!(self.id, MacroId::ProcMacroId(_))
|
||||
}
|
||||
|
||||
pub fn kind(&self, db: &dyn HirDatabase) -> MacroKind {
|
||||
match self.id {
|
||||
MacroId::Macro2Id(it) => match it.lookup(db.upcast()).expander {
|
||||
|
|
|
@ -260,23 +260,23 @@ impl From<hir::MacroKind> for SymbolKind {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<hir::ModuleDefId> for SymbolKind {
|
||||
fn from(it: hir::ModuleDefId) -> Self {
|
||||
impl From<hir::ModuleDef> for SymbolKind {
|
||||
fn from(it: hir::ModuleDef) -> Self {
|
||||
match it {
|
||||
hir::ModuleDefId::ConstId(..) => SymbolKind::Const,
|
||||
hir::ModuleDefId::EnumVariantId(..) => SymbolKind::Variant,
|
||||
hir::ModuleDefId::FunctionId(..) => SymbolKind::Function,
|
||||
hir::ModuleDefId::MacroId(hir::MacroId::ProcMacroId(..)) => SymbolKind::ProcMacro,
|
||||
hir::ModuleDefId::MacroId(..) => SymbolKind::Macro,
|
||||
hir::ModuleDefId::ModuleId(..) => SymbolKind::Module,
|
||||
hir::ModuleDefId::StaticId(..) => SymbolKind::Static,
|
||||
hir::ModuleDefId::AdtId(hir::AdtId::StructId(..)) => SymbolKind::Struct,
|
||||
hir::ModuleDefId::AdtId(hir::AdtId::EnumId(..)) => SymbolKind::Enum,
|
||||
hir::ModuleDefId::AdtId(hir::AdtId::UnionId(..)) => SymbolKind::Union,
|
||||
hir::ModuleDefId::TraitId(..) => SymbolKind::Trait,
|
||||
hir::ModuleDefId::TraitAliasId(..) => SymbolKind::TraitAlias,
|
||||
hir::ModuleDefId::TypeAliasId(..) => SymbolKind::TypeAlias,
|
||||
hir::ModuleDefId::BuiltinType(..) => SymbolKind::TypeAlias,
|
||||
hir::ModuleDef::Const(..) => SymbolKind::Const,
|
||||
hir::ModuleDef::Variant(..) => SymbolKind::Variant,
|
||||
hir::ModuleDef::Function(..) => SymbolKind::Function,
|
||||
hir::ModuleDef::Macro(mac) if mac.is_proc_macro() => SymbolKind::ProcMacro,
|
||||
hir::ModuleDef::Macro(..) => SymbolKind::Macro,
|
||||
hir::ModuleDef::Module(..) => SymbolKind::Module,
|
||||
hir::ModuleDef::Static(..) => SymbolKind::Static,
|
||||
hir::ModuleDef::Adt(hir::Adt::Struct(..)) => SymbolKind::Struct,
|
||||
hir::ModuleDef::Adt(hir::Adt::Enum(..)) => SymbolKind::Enum,
|
||||
hir::ModuleDef::Adt(hir::Adt::Union(..)) => SymbolKind::Union,
|
||||
hir::ModuleDef::Trait(..) => SymbolKind::Trait,
|
||||
hir::ModuleDef::TraitAlias(..) => SymbolKind::TraitAlias,
|
||||
hir::ModuleDef::TypeAlias(..) => SymbolKind::TypeAlias,
|
||||
hir::ModuleDef::BuiltinType(..) => SymbolKind::TypeAlias,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ impl TryToNav for FileSymbol {
|
|||
|it| it.display_no_db(edition).to_smolstr(),
|
||||
),
|
||||
alias: self.is_alias.then(|| self.name.clone()),
|
||||
kind: Some(hir::ModuleDefId::from(self.def).into()),
|
||||
kind: Some(self.def.into()),
|
||||
full_range,
|
||||
focus_range,
|
||||
container_name: self.container_name.clone(),
|
||||
|
|
Loading…
Reference in a new issue