]> git.lizzy.rs Git - rust.git/blob - tests/ui/pattern_type_mismatch/pattern_alternatives.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / pattern_type_mismatch / pattern_alternatives.rs
1 #![allow(clippy::all)]
2 #![warn(clippy::pattern_type_mismatch)]
3
4 fn main() {}
5
6 fn alternatives() {
7     enum Value<'a> {
8         Unused,
9         A(&'a Option<i32>),
10         B,
11     }
12     let ref_value = &Value::A(&Some(23));
13
14     // not ok
15     if let Value::B | Value::A(_) = ref_value {}
16     if let &Value::B | &Value::A(Some(_)) = ref_value {}
17     if let Value::B | Value::A(Some(_)) = *ref_value {}
18
19     // ok
20     if let &Value::B | &Value::A(_) = ref_value {}
21     if let Value::B | Value::A(_) = *ref_value {}
22     if let &Value::B | &Value::A(&Some(_)) = ref_value {}
23     if let Value::B | Value::A(&Some(_)) = *ref_value {}
24 }