From 07deb93bb291917967d167fa6cdacc62b0186599 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 15 Sep 2019 18:44:32 +0200 Subject: [PATCH] or-patterns: middle/dead: make a hack less hacky. --- src/librustc/middle/dead.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 666c1cc96f2..1818dede3e2 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -260,8 +260,8 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) { fn visit_arm(&mut self, arm: &'tcx hir::Arm) { let pats = arm.top_pats_hack(); - if pats.len() == 1 { - let variants = pats[0].necessary_variants(); + if let [pat] = pats { + let variants = pat.necessary_variants(); // Inside the body, ignore constructions of variants // necessary for the pattern to match. Those construction sites