aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-11 18:23:59 +0100
committerLukas Wirth <[email protected]>2021-06-11 18:24:52 +0100
commit48f65b3b157a5b974be6252dd8fc9ffc158d4217 (patch)
tree202abc290828e43fcfca625bfe5ffcd85f050153 /crates/hir
parentc6133fe51c2cf31d776f16d520de4f78c709181c (diff)
Item search now respects trait impl items
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index debc3ee62..68ac8400c 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1450,6 +1450,20 @@ impl AssocItem {
1450 _ => None, 1450 _ => None,
1451 } 1451 }
1452 } 1452 }
1453
1454 pub fn containing_trait_impl(self, db: &dyn HirDatabase) -> Option<Trait> {
1455 match self.container(db) {
1456 AssocItemContainer::Impl(i) => i.trait_(db),
1457 _ => None,
1458 }
1459 }
1460
1461 pub fn containing_trait_or_trait_impl(self, db: &dyn HirDatabase) -> Option<Trait> {
1462 match self.container(db) {
1463 AssocItemContainer::Trait(t) => Some(t),
1464 AssocItemContainer::Impl(i) => i.trait_(db),
1465 }
1466 }
1453} 1467}
1454 1468
1455impl HasVisibility for AssocItem { 1469impl HasVisibility for AssocItem {