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
18 bar((true)); //~ ERROR unnecessary parentheses around function argument
20 if (true) {} //~ ERROR unnecessary parentheses around `if` condition
21 while (true) {} //~ ERROR unnecessary parentheses around `while` condition
22 //~^ WARN denote infinite loops with
23 match (true) { //~ ERROR unnecessary parentheses around `match` head expression
26 if let 1 = (1) {} //~ ERROR unnecessary parentheses around `let` head expression
27 while let 1 = (2) {} //~ ERROR unnecessary parentheses around `let` head expression
28 let v = X { y: false };
29 // struct lits needs parens, so these shouldn't warn.
30 if (v == X { y: true }) {}
31 if (X { y: true } == v) {}
32 if (X { y: false }.y) {}
34 while (X { y: false }.foo(true)) {}
35 while (true | X { y: false }.y) {}
37 match (X { y: false }) {
41 X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument
43 let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
44 _a = (0); //~ ERROR unnecessary parentheses around assigned value
45 _a += (1); //~ ERROR unnecessary parentheses around assigned value