aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/method_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/method_resolution.rs')
-rw-r--r--crates/ra_hir_ty/src/method_resolution.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs
index c19519cf1..201604e1d 100644
--- a/crates/ra_hir_ty/src/method_resolution.rs
+++ b/crates/ra_hir_ty/src/method_resolution.rs
@@ -72,13 +72,8 @@ impl CrateImplDefs {
72 impls_by_trait: FxHashMap::default(), 72 impls_by_trait: FxHashMap::default(),
73 }; 73 };
74 74
75 // For each dependency, calculate `impls_from_deps` recursively, then add its own 75 for krate in crate_graph.transitive_deps(krate) {
76 // `impls_in_crate`. 76 res.merge(&db.impls_in_crate(krate));
77 // As we might visit crates multiple times, `merge` has to deduplicate impls to avoid
78 // wasting memory.
79 for dep in &crate_graph[krate].dependencies {
80 res.merge(&db.impls_from_deps(dep.crate_id));
81 res.merge(&db.impls_in_crate(dep.crate_id));
82 } 77 }
83 78
84 Arc::new(res) 79 Arc::new(res)
@@ -114,8 +109,6 @@ impl CrateImplDefs {
114 for (fp, impls) in &other.inherent_impls { 109 for (fp, impls) in &other.inherent_impls {
115 let vec = self.inherent_impls.entry(*fp).or_default(); 110 let vec = self.inherent_impls.entry(*fp).or_default();
116 vec.extend(impls); 111 vec.extend(impls);
117 vec.sort();
118 vec.dedup();
119 } 112 }
120 113
121 for (trait_, other_map) in &other.impls_by_trait { 114 for (trait_, other_map) in &other.impls_by_trait {
@@ -123,8 +116,6 @@ impl CrateImplDefs {
123 for (fp, impls) in other_map { 116 for (fp, impls) in other_map {
124 let vec = map.entry(*fp).or_default(); 117 let vec = map.entry(*fp).or_default();
125 vec.extend(impls); 118 vec.extend(impls);
126 vec.sort();
127 vec.dedup();
128 } 119 }
129 } 120 }
130 } 121 }