diff options
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/pat.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs index 3fe1a4abb..06b09af82 100644 --- a/crates/ra_hir_ty/src/infer/pat.rs +++ b/crates/ra_hir_ty/src/infer/pat.rs | |||
@@ -185,21 +185,18 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
185 | self.write_pat_ty(pat, bound_ty); | 185 | self.write_pat_ty(pat, bound_ty); |
186 | return inner_ty; | 186 | return inner_ty; |
187 | } | 187 | } |
188 | Pat::Slice { prefix, slice, suffix } => { | 188 | Pat::Slice { prefix, slice: _slice, suffix } => { |
189 | if let Ty::Apply(ApplicationTy { ctor: TypeCtor::Slice, parameters }) = expected { | 189 | let ty = if let Ty::Apply(ApplicationTy { ctor: TypeCtor::Slice, parameters }) = expected { |
190 | match (prefix.as_slice(), slice, suffix.as_slice()) { | 190 | for pat_id in prefix.iter().chain(suffix) { |
191 | (prefix_pat_ids, None, []) => { | 191 | self.infer_pat(*pat_id, parameters.as_single(), default_bm); |
192 | for pat_id in prefix_pat_ids { | ||
193 | self.infer_pat(*pat_id, parameters.as_single(), default_bm); | ||
194 | } | ||
195 | |||
196 | Ty::apply_one(TypeCtor::Slice, parameters.as_single().clone()) | ||
197 | }, | ||
198 | _ => Ty::Unknown, | ||
199 | } | 192 | } |
193 | |||
194 | parameters.as_single().clone() | ||
200 | } else { | 195 | } else { |
201 | Ty::Unknown | 196 | Ty::Unknown |
202 | } | 197 | }; |
198 | |||
199 | Ty::apply_one(TypeCtor::Slice, ty) | ||
203 | } | 200 | } |
204 | _ => Ty::Unknown, | 201 | _ => Ty::Unknown, |
205 | }; | 202 | }; |