From 79561b9d2e901e2624f94ffa7bc6017f0249f23d Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 15 Mar 2021 14:31:55 +0100 Subject: goto_implementation: Look at the entire crate graph for trait impls --- crates/hir/src/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 42a805c57..d13b4d5fd 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1488,7 +1488,7 @@ impl Impl { pub fn all_for_type(db: &dyn HirDatabase, Type { krate, ty }: Type) -> Vec { let def_crates = match ty.value.def_crates(db, krate) { Some(def_crates) => def_crates, - None => return vec![], + None => return Vec::new(), }; let filter = |impl_def: &Impl| { @@ -1498,16 +1498,11 @@ impl Impl { }; let mut all = Vec::new(); - def_crates.iter().for_each(|&id| { + def_crates.into_iter().for_each(|id| { all.extend(db.inherent_impls_in_crate(id).all_impls().map(Self::from).filter(filter)) }); let fp = TyFingerprint::for_impl(&ty.value); - for id in def_crates - .iter() - .flat_map(|&id| Crate { id }.reverse_dependencies(db)) - .map(|Crate { id }| id) - .chain(def_crates.iter().copied()) - { + for id in db.crate_graph().iter() { match fp { Some(fp) => all.extend( db.trait_impls_in_crate(id).for_self_ty(fp).map(Self::from).filter(filter), -- cgit v1.2.3