Skip to content

Commit 594cf1d

Browse files
committed
review
1 parent 7843e46 commit 594cf1d

File tree

1 file changed

+9
-4
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+9
-4
lines changed

compiler/rustc_mir_build/src/build/matches/mod.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,12 @@ struct PatternExtraData<'tcx> {
938938
ascriptions: Vec<Ascription<'tcx>>,
939939
}
940940

941+
impl<'tcx> PatternExtraData<'tcx> {
942+
fn is_empty(&self) -> bool {
943+
self.bindings.is_empty() && self.ascriptions.is_empty()
944+
}
945+
}
946+
941947
/// A pattern in a form suitable for generating code.
942948
#[derive(Debug, Clone)]
943949
struct FlatPat<'pat, 'tcx> {
@@ -970,7 +976,7 @@ impl<'tcx, 'pat> FlatPat<'pat, 'tcx> {
970976

971977
#[derive(Debug)]
972978
struct Candidate<'pat, 'tcx> {
973-
/// For the candidate to match, &ll of these must be satisfied...
979+
/// For the candidate to match, all of these must be satisfied...
974980
// Invariant: all the `MatchPair`s are recursively simplified.
975981
// Invariant: or-patterns must be sorted at the end.
976982
match_pairs: Vec<MatchPair<'pat, 'tcx>>,
@@ -1518,9 +1524,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15181524
self.merge_trivial_subcandidates(subcandidate, source_info);
15191525

15201526
// FIXME(or_patterns; matthewjasper) Try to be more aggressive here.
1521-
can_merge &= subcandidate.subcandidates.is_empty()
1522-
&& subcandidate.extra_data.bindings.is_empty()
1523-
&& subcandidate.extra_data.ascriptions.is_empty();
1527+
can_merge &=
1528+
subcandidate.subcandidates.is_empty() && subcandidate.extra_data.is_empty();
15241529
}
15251530

15261531
if can_merge {

0 commit comments

Comments
 (0)