Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/pat.rs')
| -rw-r--r-- | crates/hir-ty/src/infer/pat.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir-ty/src/infer/pat.rs b/crates/hir-ty/src/infer/pat.rs index 1bf8babe83..09a4d998ee 100644 --- a/crates/hir-ty/src/infer/pat.rs +++ b/crates/hir-ty/src/infer/pat.rs @@ -93,7 +93,7 @@ impl InferenceContext<'_> { ty.as_adt().map(|(_, s)| s.clone()).unwrap_or_else(|| Substitution::empty(Interner)); match def { - _ if subs.len() == 0 => {} + _ if subs.is_empty() => {} Some(def) => { let field_types = self.db.field_types(def); let variant_data = def.variant_data(self.db.upcast()); @@ -223,13 +223,13 @@ impl InferenceContext<'_> { ) -> Ty { let expected = self.resolve_ty_shallow(expected); let expectations = match expected.as_tuple() { - Some(parameters) => &*parameters.as_slice(Interner), + Some(parameters) => parameters.as_slice(Interner), _ => &[], }; let ((pre, post), n_uncovered_patterns) = match ellipsis { Some(idx) => (subs.split_at(idx), expectations.len().saturating_sub(subs.len())), - None => ((&subs[..], &[][..]), 0), + None => ((subs, &[][..]), 0), }; let mut expectations_iter = expectations .iter() @@ -423,7 +423,7 @@ impl InferenceContext<'_> { self.result.binding_modes.insert(pat, mode); let inner_ty = match subpat { - Some(subpat) => self.infer_pat(subpat, &expected, default_bm), + Some(subpat) => self.infer_pat(subpat, expected, default_bm), None => expected.clone(), }; let inner_ty = self.insert_type_vars_shallow(inner_ty); @@ -436,7 +436,7 @@ impl InferenceContext<'_> { }; self.write_pat_ty(pat, inner_ty.clone()); self.write_binding_ty(binding, bound_ty); - return inner_ty; + inner_ty } fn infer_slice_pat( |