From db4a1fcab4610db2ab31d2048ab49fbcbcfce1cc Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 11 Jun 2021 19:55:24 +0200 Subject: Replace some AssocItem::containing_trait calls trait_or_trait_impl --- crates/ide/src/goto_implementation.rs | 4 ++-- crates/ide_completion/src/render.rs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index 43356a94e..95fd39850 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs @@ -52,13 +52,13 @@ pub(crate) fn goto_implementation( hir::ModuleDef::Function(f) => { let assoc = f.as_assoc_item(sema.db)?; let name = assoc.name(sema.db)?; - let trait_ = assoc.containing_trait(sema.db)?; + let trait_ = assoc.containing_trait_or_trait_impl(sema.db)?; impls_for_trait_item(&sema, trait_, name) } hir::ModuleDef::Const(c) => { let assoc = c.as_assoc_item(sema.db)?; let name = assoc.name(sema.db)?; - let trait_ = assoc.containing_trait(sema.db)?; + let trait_ = assoc.containing_trait_or_trait_impl(sema.db)?; impls_for_trait_item(&sema, trait_, name) } _ => return None, diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index 902df46ca..f24ef7e49 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs @@ -111,7 +111,10 @@ impl<'a> RenderContext<'a> { hir::AssocItem::TypeAlias(it) => self.is_deprecated(it), }; is_assoc_deprecated - || assoc.containing_trait(db).map(|trait_| self.is_deprecated(trait_)).unwrap_or(false) + || assoc + .containing_trait_or_trait_impl(db) + .map(|trait_| self.is_deprecated(trait_)) + .unwrap_or(false) } fn docs(&self, node: impl HasAttrs) -> Option { -- cgit v1.2.3