]> git.lizzy.rs Git - rust.git/blob - src/test/ui/or-patterns/mix-with-wild.rs
Rollup merge of #91915 - jackh726:issue-91899, r=Mark-Simulacrum
[rust.git] / src / test / ui / or-patterns / mix-with-wild.rs
1 // Test that an or-pattern works with a wild pattern. This tests two things:
2 //
3 //  1) The Wild pattern should cause the pattern to always succeed.
4 //  2) or-patterns should work with simplifyable patterns.
5
6 // run-pass
7
8 pub fn test(x: Option<usize>) -> bool {
9     match x {
10         Some(0 | _) => true,
11         _ => false,
12     }
13 }
14
15 fn main() {
16     assert!(test(Some(42)));
17     assert!(!test(None));
18 }