From e74c55bb4adcad001b0f7373ebff795fc2aaeb1b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 1 Mar 2021 00:05:22 +0200 Subject: Refactor the import location --- crates/hir/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 62692c2c1..c4691d34c 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1115,6 +1115,7 @@ pub enum AssocItem { Const(Const), TypeAlias(TypeAlias), } +#[derive(Debug)] pub enum AssocItemContainer { Trait(Trait), Impl(Impl), @@ -2148,6 +2149,16 @@ impl ScopeDef { } } +impl From for ScopeDef { + fn from(item: ItemInNs) -> Self { + match item { + ItemInNs::Types(id) => ScopeDef::ModuleDef(id.into()), + ItemInNs::Values(id) => ScopeDef::ModuleDef(id.into()), + ItemInNs::Macros(id) => ScopeDef::MacroDef(id.into()), + } + } +} + pub trait HasVisibility { fn visibility(&self, db: &dyn HirDatabase) -> Visibility; fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool { -- cgit v1.2.3