]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/try_block.rs
Merge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyup
[rust.git] / src / tools / rustfmt / tests / target / try_block.rs
1 // rustfmt-edition: 2018
2
3 fn main() -> Result<(), !> {
4     let _x: Option<_> = try { 4 };
5
6     try {}
7 }
8
9 fn baz() -> Option<i32> {
10     if (1 == 1) {
11         return try { 5 };
12     }
13
14     // test
15     let x: Option<()> = try {
16         // try blocks are great
17     };
18
19     let y: Option<i32> = try { 6 }; // comment
20
21     let x: Option<i32> = try {
22         baz()?;
23         baz()?;
24         baz()?;
25         7
26     };
27
28     return None;
29 }