1 #![deny(unused_parens)]
3 #[derive(Eq, PartialEq)]
6 fn foo(&self, conjunct: bool) -> bool { self.y && conjunct }
10 return (1); //~ ERROR unnecessary parentheses around `return` value
12 fn bar(y: bool) -> X {
13 return (X { y }); //~ ERROR unnecessary parentheses around `return` value
16 fn unused_parens_around_return_type() -> (u32) { //~ ERROR unnecessary parentheses around type
24 fn passes_unused_parens_lint() -> &'static (dyn Trait) {
30 bar((true)); //~ ERROR unnecessary parentheses around function argument
32 if (true) {} //~ ERROR unnecessary parentheses around `if` condition
33 while (true) {} //~ ERROR unnecessary parentheses around `while` condition
34 //~^ WARN denote infinite loops with
35 match (true) { //~ ERROR unnecessary parentheses around `match` head expression
38 if let 1 = (1) {} //~ ERROR unnecessary parentheses around `let` head expression
39 while let 1 = (2) {} //~ ERROR unnecessary parentheses around `let` head expression
40 let v = X { y: false };
41 // struct lits needs parens, so these shouldn't warn.
42 if (v == X { y: true }) {}
43 if (X { y: true } == v) {}
44 if (X { y: false }.y) {}
46 while (X { y: false }.foo(true)) {}
47 while (true | X { y: false }.y) {}
49 match (X { y: false }) {
53 X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument
55 let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
56 _a = (0); //~ ERROR unnecessary parentheses around assigned value
57 _a += (1); //~ ERROR unnecessary parentheses around assigned value