about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_mir_build/src/build/matches/mod.rs6
-rw-r--r--compiler/rustc_mir_build/src/build/matches/simplify.rs18
2 files changed, 3 insertions, 21 deletions
diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs
index 6d083e66a9b..0fb5ed89437 100644
--- a/compiler/rustc_mir_build/src/build/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/build/matches/mod.rs
@@ -1299,7 +1299,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 for candidate in candidates.iter_mut() {
                     candidate.visit_leaves(|leaf_candidate| new_candidates.push(leaf_candidate));
                 }
-                self.match_simplified_candidates(
+                self.match_candidates(
                     span,
                     scrutinee_span,
                     start_block,
@@ -1556,11 +1556,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
         }
 
         let mut can_merge = true;
-
-        // Not `Iterator::all` because we don't want to short-circuit.
         for subcandidate in &mut candidate.subcandidates {
-            self.merge_trivial_subcandidates(subcandidate);
-
             // FIXME(or_patterns; matthewjasper) Try to be more aggressive here.
             can_merge &=
                 subcandidate.subcandidates.is_empty() && subcandidate.extra_data.is_empty();
diff --git a/compiler/rustc_mir_build/src/build/matches/simplify.rs b/compiler/rustc_mir_build/src/build/matches/simplify.rs
index bf1906f370b..0c4d45ea050 100644
--- a/compiler/rustc_mir_build/src/build/matches/simplify.rs
+++ b/compiler/rustc_mir_build/src/build/matches/simplify.rs
@@ -67,26 +67,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
         debug!(simplified = ?match_pairs, "simplify_match_pairs");
     }
 
-    /// Create a new candidate for each pattern in `pats`, and recursively simplify tje
-    /// single-or-pattern case.
+    /// Create a new candidate for each pattern in `pats`.
     pub(super) fn create_or_subcandidates<'pat>(
         &mut self,
         pats: &[FlatPat<'pat, 'tcx>],
         has_guard: bool,
     ) -> Vec<Candidate<'pat, 'tcx>> {
-        pats.iter()
-            .cloned()
-            .map(|flat_pat| {
-                let mut candidate = Candidate::from_flat_pat(flat_pat, has_guard);
-                if let [MatchPair { test_case: TestCase::Or { pats, .. }, .. }] =
-                    &*candidate.match_pairs
-                {
-                    candidate.subcandidates = self.create_or_subcandidates(pats, has_guard);
-                    let first_match_pair = candidate.match_pairs.pop().unwrap();
-                    candidate.or_span = Some(first_match_pair.pattern.span);
-                }
-                candidate
-            })
-            .collect()
+        pats.iter().cloned().map(|flat_pat| Candidate::from_flat_pat(flat_pat, has_guard)).collect()
     }
 }