Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
This commit is contained in:
parent
89e52e2ca9
commit
1d90ed6370
@ -840,10 +840,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// (false, true) => (),
|
||||
/// }
|
||||
///
|
||||
/// For this match we check if `x.0` matches `true` (for the first
|
||||
/// arm) if that's false we check `x.1`, if it's `true` we check if
|
||||
/// For this match, we check if `x.0` matches `true` (for the first
|
||||
/// arm). If that's false, we check `x.1`. If it's `true` we check if
|
||||
/// `x.0` matches `false` (for the third arm). In the (impossible at
|
||||
/// runtime) case when `x.0` is now `true` we branch to
|
||||
/// runtime) case when `x.0` is now `true`, we branch to
|
||||
/// `otherwise_block`.
|
||||
fn match_candidates<'pat>(
|
||||
&mut self,
|
||||
@ -1104,6 +1104,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
) {
|
||||
let (first_candidate, remaining_candidates) = candidates.split_first_mut().unwrap();
|
||||
|
||||
// All of the or-patterns have been sorted to the end, so if the first
|
||||
// pattern is an or-pattern we only have or-patterns.
|
||||
match *first_candidate.match_pairs[0].pattern.kind {
|
||||
PatKind::Or { .. } => (),
|
||||
_ => {
|
||||
|
@ -26,9 +26,6 @@ fn test_foo(x: Foo) -> MatchArm {
|
||||
// multiple or-patterns for one structure.
|
||||
Foo::Two(42 | 255, 1024 | 2048) => MatchArm::Arm(2),
|
||||
// mix of pattern types in one or-pattern (range).
|
||||
//
|
||||
// FIXME(dlrobertson | Nadrieril): Fix or-pattern completeness and
|
||||
// unreachabilitychecks for ranges.
|
||||
Foo::One(100 | 110..=120 | 210..=220) => MatchArm::Arm(3),
|
||||
// multiple or-patterns with wild.
|
||||
Foo::Two(0..=10 | 100..=110, 0 | _) => MatchArm::Arm(4),
|
||||
|
Loading…
x
Reference in New Issue
Block a user