From ca6548827634155f28e75bc6cb2e734d2d5d1e95 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 19 Jan 2021 01:08:59 +0200 Subject: Show deprecated completions for deprecated traits --- crates/hir/src/code_model.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'crates/hir/src') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 2950f08b8..5a4c27906 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -272,15 +272,6 @@ impl ModuleDef { hir_ty::diagnostics::validate_module_item(db, module.id.krate, id, sink) } - - pub fn as_assoc_item(self, db: &dyn HirDatabase) -> Option { - match self { - ModuleDef::Function(f) => f.as_assoc_item(db), - ModuleDef::Const(c) => c.as_assoc_item(db), - ModuleDef::TypeAlias(t) => t.as_assoc_item(db), - _ => None, - } - } } impl Module { @@ -1060,6 +1051,16 @@ impl AsAssocItem for TypeAlias { as_assoc_item(db, AssocItem::TypeAlias, self.id) } } +impl AsAssocItem for ModuleDef { + fn as_assoc_item(self, db: &dyn HirDatabase) -> Option { + match self { + ModuleDef::Function(it) => it.as_assoc_item(db), + ModuleDef::Const(it) => it.as_assoc_item(db), + ModuleDef::TypeAlias(it) => it.as_assoc_item(db), + _ => None, + } + } +} fn as_assoc_item(db: &dyn HirDatabase, ctor: CTOR, id: ID) -> Option where ID: Lookup>, -- cgit v1.2.3