about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2019-09-18 20:07:33 -0400
committerAaron Hill <aa1ronham@gmail.com>2019-09-18 20:07:33 -0400
commit41e1128969adc0190c946ccbd8b6b89ad197bc34 (patch)
treedb29d54014720716a804e45101e9eaf07e1a7f9a
parenta8ce93e13a9f1e7d7933ca76f6cae9c8f6127c34 (diff)
downloadrust-41e1128969adc0190c946ccbd8b6b89ad197bc34.tar.gz
rust-41e1128969adc0190c946ccbd8b6b89ad197bc34.zip
Use 'if let' instead of 'match'
-rw-r--r--src/librustc_typeck/check/_match.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 9481638fc14..50fd72f0613 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -173,17 +173,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         // we can emit a better note. Rather than pointing
         // at a diverging expression in an arbitrary arm,
         // we can point at the entire `match` expression
-        match (all_arms_diverge, match_src) {
-            (Diverges::Always { .. }, hir::MatchSource::Normal) => {
-                all_arms_diverge = Diverges::Always {
-                    span: expr.span,
-                    custom_note: Some(
-                        "any code following this `match` expression is unreachable, \
-                        as all arms diverge"
-                    )
-                };
-            },
-            _ => {}
+        if let (Diverges::Always { .. }, hir::MatchSource::Normal) = (all_arms_diverge, match_src) {
+            all_arms_diverge = Diverges::Always {
+                span: expr.span,
+                custom_note: Some(
+                    "any code following this `match` expression is unreachable, as all arms diverge"
+                )
+            };
         }
 
         // We won't diverge unless the discriminant or all arms diverge.