diff options
author | Lukas Wirth <[email protected]> | 2021-06-11 18:55:24 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-11 18:55:24 +0100 |
commit | db4a1fcab4610db2ab31d2048ab49fbcbcfce1cc (patch) | |
tree | 7893024cc5766e5880bb8f97684aebd31a55bb6d /crates | |
parent | 48f65b3b157a5b974be6252dd8fc9ffc158d4217 (diff) |
Replace some AssocItem::containing_trait calls trait_or_trait_impl
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide/src/goto_implementation.rs | 4 | ||||
-rw-r--r-- | crates/ide_completion/src/render.rs | 5 |
2 files changed, 6 insertions, 3 deletions
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( | |||
52 | hir::ModuleDef::Function(f) => { | 52 | hir::ModuleDef::Function(f) => { |
53 | let assoc = f.as_assoc_item(sema.db)?; | 53 | let assoc = f.as_assoc_item(sema.db)?; |
54 | let name = assoc.name(sema.db)?; | 54 | let name = assoc.name(sema.db)?; |
55 | let trait_ = assoc.containing_trait(sema.db)?; | 55 | let trait_ = assoc.containing_trait_or_trait_impl(sema.db)?; |
56 | impls_for_trait_item(&sema, trait_, name) | 56 | impls_for_trait_item(&sema, trait_, name) |
57 | } | 57 | } |
58 | hir::ModuleDef::Const(c) => { | 58 | hir::ModuleDef::Const(c) => { |
59 | let assoc = c.as_assoc_item(sema.db)?; | 59 | let assoc = c.as_assoc_item(sema.db)?; |
60 | let name = assoc.name(sema.db)?; | 60 | let name = assoc.name(sema.db)?; |
61 | let trait_ = assoc.containing_trait(sema.db)?; | 61 | let trait_ = assoc.containing_trait_or_trait_impl(sema.db)?; |
62 | impls_for_trait_item(&sema, trait_, name) | 62 | impls_for_trait_item(&sema, trait_, name) |
63 | } | 63 | } |
64 | _ => return None, | 64 | _ => 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> { | |||
111 | hir::AssocItem::TypeAlias(it) => self.is_deprecated(it), | 111 | hir::AssocItem::TypeAlias(it) => self.is_deprecated(it), |
112 | }; | 112 | }; |
113 | is_assoc_deprecated | 113 | is_assoc_deprecated |
114 | || assoc.containing_trait(db).map(|trait_| self.is_deprecated(trait_)).unwrap_or(false) | 114 | || assoc |
115 | .containing_trait_or_trait_impl(db) | ||
116 | .map(|trait_| self.is_deprecated(trait_)) | ||
117 | .unwrap_or(false) | ||
115 | } | 118 | } |
116 | 119 | ||
117 | fn docs(&self, node: impl HasAttrs) -> Option<hir::Documentation> { | 120 | fn docs(&self, node: impl HasAttrs) -> Option<hir::Documentation> { |