From 89d410cef571f5fa7631b17e2fbe52a8f8f03990 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 28 Feb 2021 10:32:15 +0200 Subject: Do not propose already imported imports --- crates/hir/src/semantics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir') diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 945638cc5..69370ef3d 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -774,7 +774,7 @@ fn find_root(node: &SyntaxNode) -> SyntaxNode { /// /// Note that if you are wondering "what does this specific existing name mean?", /// you'd better use the `resolve_` family of methods. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct SemanticsScope<'a> { pub db: &'a dyn HirDatabase, file_id: HirFileId, -- cgit v1.2.3 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 From dccbb38d2e28bfeb53f31c13de3b83e72f1a476c Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 8 Mar 2021 00:25:45 +0200 Subject: Less lifetines: derive SemanticsScope in place --- crates/hir/src/semantics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir') diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 69370ef3d..945638cc5 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -774,7 +774,7 @@ fn find_root(node: &SyntaxNode) -> SyntaxNode { /// /// Note that if you are wondering "what does this specific existing name mean?", /// you'd better use the `resolve_` family of methods. -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct SemanticsScope<'a> { pub db: &'a dyn HirDatabase, file_id: HirFileId, -- cgit v1.2.3