diff options
author | Florian Diebold <[email protected]> | 2019-09-16 20:48:46 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-09-17 18:47:45 +0100 |
commit | 53a932509dbb9dfdaabb27a0d7fc3fe87e44ec55 (patch) | |
tree | 0eba5ecdcd5b1a0dd5e6f046503a03ab14be891f /crates/ra_hir/src/ty | |
parent | 35d1c038967b9d69f2e501e24fec8351f3948779 (diff) |
Small review improvements
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index e6cd5d0be..35fdd4a37 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -129,7 +129,7 @@ impl Ty { | |||
129 | }) | 129 | }) |
130 | } | 130 | } |
131 | None => { | 131 | None => { |
132 | // associated type not found (FIXME: report error) | 132 | // FIXME: report error (associated type not found) |
133 | Ty::Unknown | 133 | Ty::Unknown |
134 | } | 134 | } |
135 | } | 135 | } |
@@ -197,7 +197,6 @@ impl Ty { | |||
197 | let env = trait_env(db, resolver); | 197 | let env = trait_env(db, resolver); |
198 | let traits_from_env = env.trait_predicates_for_self_ty(&self_ty).map(|tr| tr.trait_); | 198 | let traits_from_env = env.trait_predicates_for_self_ty(&self_ty).map(|tr| tr.trait_); |
199 | let traits = traits_from_env.flat_map(|t| t.all_super_traits(db)); | 199 | let traits = traits_from_env.flat_map(|t| t.all_super_traits(db)); |
200 | let mut result = Ty::Unknown; | ||
201 | for t in traits { | 200 | for t in traits { |
202 | if let Some(associated_ty) = t.associated_type_by_name(db, &segment.name) { | 201 | if let Some(associated_ty) = t.associated_type_by_name(db, &segment.name) { |
203 | let generics = t.generic_params(db); | 202 | let generics = t.generic_params(db); |
@@ -207,11 +206,10 @@ impl Ty { | |||
207 | iter::repeat(Ty::Unknown).take(generics.count_params_including_parent() - 1), | 206 | iter::repeat(Ty::Unknown).take(generics.count_params_including_parent() - 1), |
208 | ); | 207 | ); |
209 | // FIXME handle type parameters on the segment | 208 | // FIXME handle type parameters on the segment |
210 | result = Ty::Projection(ProjectionTy { associated_ty, parameters: substs.into() }); | 209 | return Ty::Projection(ProjectionTy { associated_ty, parameters: substs.into() }); |
211 | break; | ||
212 | } | 210 | } |
213 | } | 211 | } |
214 | result | 212 | Ty::Unknown |
215 | } | 213 | } |
216 | 214 | ||
217 | fn from_hir_path_inner( | 215 | fn from_hir_path_inner( |