summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/source/catch.rs
blob: 541db1dc90c226889569ce151bc51b6c6b629b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// rustfmt-edition: 2018
#![feature(try_blocks)]

fn main() {
    let x = try {
        foo()?
    };

    let x = try /* Invisible comment */ { foo()? };

    let x = try {
        unsafe { foo()? }
    };

    let y = match (try {
        foo()?
    }) {
        _ => (),
    };

    try {
        foo()?;
    };

    try {
        // Regular try block
    };
}