diff options
author | Josh Mcguigan <[email protected]> | 2020-03-01 20:13:05 +0000 |
---|---|---|
committer | Josh Mcguigan <[email protected]> | 2020-03-01 20:13:05 +0000 |
commit | b9ef7a6b987eea4b0b14298fbbe44d912806f50f (patch) | |
tree | 0f52557e781de0b355512c99935f94223a563517 /crates/ra_hir_ty/src/infer | |
parent | d0e282f6b1a8c698212f7f76de2ff122e36e17a2 (diff) |
remove match statement, handle suffix
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 | }; |