]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfcs/rfc-2005-default-binding-mode/enum.rs
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / ui / rfcs / rfc-2005-default-binding-mode / enum.rs
1 // run-pass
2 enum Wrapper {
3     Wrap(i32),
4 }
5
6 use Wrapper::Wrap;
7
8 pub fn main() {
9     let Wrap(x) = &Wrap(3);
10     println!("{}", *x);
11
12     let Wrap(x) = &mut Wrap(3);
13     println!("{}", *x);
14
15     if let Some(x) = &Some(3) {
16         println!("{}", *x);
17     } else {
18         panic!();
19     }
20
21     if let Some(x) = &mut Some(3) {
22         println!("{}", *x);
23     } else {
24         panic!();
25     }
26
27     if let Some(x) = &mut Some(3) {
28         *x += 1;
29     } else {
30         panic!();
31     }
32
33     while let Some(x) = &Some(3) {
34         println!("{}", *x);
35         break;
36     }
37     while let Some(x) = &mut Some(3) {
38         println!("{}", *x);
39         break;
40     }
41     while let Some(x) = &mut Some(3) {
42         *x += 1;
43         break;
44     }
45 }