Replace some AssocItem::containing_trait calls trait_or_trait_impl
This commit is contained in:
parent
48f65b3b15
commit
db4a1fcab4
@ -52,13 +52,13 @@ pub(crate) fn goto_implementation(
|
|||||||
hir::ModuleDef::Function(f) => {
|
hir::ModuleDef::Function(f) => {
|
||||||
let assoc = f.as_assoc_item(sema.db)?;
|
let assoc = f.as_assoc_item(sema.db)?;
|
||||||
let name = assoc.name(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)
|
impls_for_trait_item(&sema, trait_, name)
|
||||||
}
|
}
|
||||||
hir::ModuleDef::Const(c) => {
|
hir::ModuleDef::Const(c) => {
|
||||||
let assoc = c.as_assoc_item(sema.db)?;
|
let assoc = c.as_assoc_item(sema.db)?;
|
||||||
let name = assoc.name(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)
|
impls_for_trait_item(&sema, trait_, name)
|
||||||
}
|
}
|
||||||
_ => return None,
|
_ => return None,
|
||||||
|
@ -111,7 +111,10 @@ fn is_deprecated_assoc_item(&self, as_assoc_item: impl AsAssocItem) -> bool {
|
|||||||
hir::AssocItem::TypeAlias(it) => self.is_deprecated(it),
|
hir::AssocItem::TypeAlias(it) => self.is_deprecated(it),
|
||||||
};
|
};
|
||||||
is_assoc_deprecated
|
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<hir::Documentation> {
|
fn docs(&self, node: impl HasAttrs) -> Option<hir::Documentation> {
|
||||||
|
Loading…
Reference in New Issue
Block a user