mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
22 lines
343 B
Rust
22 lines
343 B
Rust
// run-pass
|
|
|
|
pub fn main() {
|
|
let x = 1;
|
|
let y = 2;
|
|
|
|
assert_eq!(3, match (x, y) {
|
|
(1, 1) => 1,
|
|
(2, 2) => 2,
|
|
(1..=2, 2) => 3,
|
|
_ => 4,
|
|
});
|
|
|
|
// nested tuple
|
|
assert_eq!(3, match ((x, y),) {
|
|
((1, 1),) => 1,
|
|
((2, 2),) => 2,
|
|
((1..=2, 2),) => 3,
|
|
_ => 4,
|
|
});
|
|
}
|