about summary refs log tree commit diff
path: root/tests/ui/lint/unused-parens-for-macro-call-with-brace.fixed
blob: 4c9995fcb61a485d182cc0c489a36a9f7af6af74 (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
//@ run-rustfix

#![deny(unused_parens)]

fn main() {
    macro_rules! x {
        () => { None::<i32> };
    }

    let Some(_) = (x!{}) else { return }; // no error
    let Some(_) = (x!{}) else { return };
    //~^ ERROR: unnecessary parentheses around assigned value

    let Some(_) = (x!{}) else { return };
    //~^ ERROR: unnecessary parentheses around pattern

    let _ = x!{};
    let _ = x!{};
    //~^ ERROR: unnecessary parentheses around assigned value

    if let Some(_) = x!{} {};
    if let Some(_) = x!{} {};
    //~^ ERROR: unnecessary parentheses around `let` scrutinee expression

    while let Some(_) = x!{} {};
    while let Some(_) = x!{} {};
    //~^ ERROR: unnecessary parentheses around `let` scrutinee expression
}