2018-10-05 21:09:14 -05:00
|
|
|
// compile-pass
|
|
|
|
|
2019-05-30 05:20:30 -05:00
|
|
|
#![allow(ellipsis_inclusive_range_patterns)]
|
2018-10-05 21:09:14 -05:00
|
|
|
#![allow(unreachable_patterns)]
|
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![warn(unused_parens)]
|
|
|
|
|
|
|
|
fn main() {
|
2019-05-30 05:20:30 -05:00
|
|
|
match 1 {
|
|
|
|
(_) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
(y) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
(ref r) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
(e @ 1...2) => {} //~ WARNING: unnecessary parentheses around outer pattern
|
|
|
|
(1...2) => {} // Non ambiguous range pattern should not warn
|
|
|
|
e @ (3...4) => {} // Non ambiguous range pattern should not warn
|
|
|
|
}
|
|
|
|
|
|
|
|
match &1 {
|
|
|
|
(e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern
|
|
|
|
&(_) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
e @ &(1...2) => {} // Ambiguous range pattern should not warn
|
|
|
|
&(1...2) => {} // Ambiguous range pattern should not warn
|
|
|
|
}
|
|
|
|
|
|
|
|
match &1 {
|
|
|
|
e @ &(1...2) | e @ &(3...4) => {} // Complex ambiguous pattern should not warn
|
|
|
|
&_ => {}
|
|
|
|
}
|
|
|
|
|
2018-10-06 21:48:04 -05:00
|
|
|
match 1 {
|
|
|
|
(_) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
(y) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
(ref r) => {} //~ WARNING: unnecessary parentheses around pattern
|
|
|
|
(e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern
|
|
|
|
(1..=2) => {} // Non ambiguous range pattern should not warn
|
|
|
|
e @ (3..=4) => {} // Non ambiguous range pattern should not warn
|
|
|
|
}
|
|
|
|
|
|
|
|
match &1 {
|
2019-05-30 05:20:30 -05:00
|
|
|
(e @ &(1..=2)) => {} //~ WARNING: unnecessary parentheses around outer pattern
|
2018-10-06 21:48:04 -05:00
|
|
|
&(_) => {} //~ WARNING: unnecessary parentheses around pattern
|
2019-05-30 05:20:30 -05:00
|
|
|
e @ &(1..=2) => {} // Ambiguous range pattern should not warn
|
2018-10-06 21:48:04 -05:00
|
|
|
&(1..=2) => {} // Ambiguous range pattern should not warn
|
2018-10-05 21:09:14 -05:00
|
|
|
}
|
|
|
|
|
2018-10-06 21:48:04 -05:00
|
|
|
match &1 {
|
2019-05-30 05:20:30 -05:00
|
|
|
e @ &(1..=2) | e @ &(3..=4) => {} // Complex ambiguous pattern should not warn
|
2018-10-06 21:48:04 -05:00
|
|
|
&_ => {}
|
2018-10-05 21:09:14 -05:00
|
|
|
}
|
|
|
|
}
|