From 2abb4c99fe8a5839fe2910e90f3471e6308f6229 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Sat, 15 May 2021 00:09:17 +0500 Subject: Fix false positive "Missing match arm". --- crates/hir_ty/src/infer/pat.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/hir_ty/src/infer/pat.rs') diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index aea354cde..60b94a642 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -126,11 +126,12 @@ impl<'a> InferenceContext<'a> { _ => &[], }; - let (pre, post) = match ellipsis { - Some(idx) => args.split_at(idx), - None => (&args[..], &[][..]), + let ((pre, post), n_uncovered_patterns) = match ellipsis { + Some(idx) => { + (args.split_at(idx), expectations.len().saturating_sub(args.len())) + } + None => ((&args[..], &[][..]), 0), }; - let n_uncovered_patterns = expectations.len().saturating_sub(args.len()); let err_ty = self.err_ty(); let mut expectations_iter = expectations.iter().map(|a| a.assert_ty_ref(&Interner)).chain(repeat(&err_ty)); -- cgit v1.2.3