Skip to content

Commit 79561b9

Browse files
committed
goto_implementation: Look at the entire crate graph for trait impls
1 parent 6241567 commit 79561b9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

crates/hir/src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ impl Impl {
14881488
pub fn all_for_type(db: &dyn HirDatabase, Type { krate, ty }: Type) -> Vec<Impl> {
14891489
let def_crates = match ty.value.def_crates(db, krate) {
14901490
Some(def_crates) => def_crates,
1491-
None => return vec![],
1491+
None => return Vec::new(),
14921492
};
14931493

14941494
let filter = |impl_def: &Impl| {
@@ -1498,16 +1498,11 @@ impl Impl {
14981498
};
14991499

15001500
let mut all = Vec::new();
1501-
def_crates.iter().for_each(|&id| {
1501+
def_crates.into_iter().for_each(|id| {
15021502
all.extend(db.inherent_impls_in_crate(id).all_impls().map(Self::from).filter(filter))
15031503
});
15041504
let fp = TyFingerprint::for_impl(&ty.value);
1505-
for id in def_crates
1506-
.iter()
1507-
.flat_map(|&id| Crate { id }.reverse_dependencies(db))
1508-
.map(|Crate { id }| id)
1509-
.chain(def_crates.iter().copied())
1510-
{
1505+
for id in db.crate_graph().iter() {
15111506
match fp {
15121507
Some(fp) => all.extend(
15131508
db.trait_impls_in_crate(id).for_self_ty(fp).map(Self::from).filter(filter),

0 commit comments

Comments
 (0)