]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnested_or_patterns.rs
Rollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum
[rust.git] / src / tools / clippy / tests / ui / unnested_or_patterns.rs
1 // run-rustfix
2
3 #![feature(or_patterns)]
4 #![feature(box_patterns)]
5 #![warn(clippy::unnested_or_patterns)]
6 #![allow(clippy::cognitive_complexity, clippy::match_ref_pats)]
7 #![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)]
8
9 fn main() {
10     if let box 0 | box 2 = Box::new(0) {}
11     if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {}
12     const C0: &u8 = &1;
13     if let &0 | C0 | &2 = &0 {}
14     if let &mut 0 | &mut 2 = &mut 0 {}
15     if let x @ 0 | x @ 2 = 0 {}
16     if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}
17     if let (1, 0) | (2, 0) | (3, 0) = (0, 0) {}
18     if let (x, ..) | (x, 1) | (x, 2) = (0, 1) {}
19     if let [0] | [1] = [0] {}
20     if let [x, 0] | [x, 1] = [0, 1] {}
21     if let [x, 0] | [x, 1] | [x, 2] = [0, 1] {}
22     if let [x, ..] | [x, 1] | [x, 2] = [0, 1] {}
23     struct TS(u8, u8);
24     if let TS(0, x) | TS(1, x) = TS(0, 0) {}
25     if let TS(1, 0) | TS(2, 0) | TS(3, 0) = TS(0, 0) {}
26     if let TS(x, ..) | TS(x, 1) | TS(x, 2) = TS(0, 0) {}
27     struct S {
28         x: u8,
29         y: u8,
30     }
31     if let S { x: 0, y } | S { y, x: 1 } = (S { x: 0, y: 1 }) {}
32     if let S { x: 0, y, .. } | S { y, x: 1 } = (S { x: 0, y: 1 }) {}
33 }