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 match (true) { //~ ERROR unnecessary parentheses around `match` head expression
25 if let 1 = (1) {} //~ ERROR unnecessary parentheses around `let` scrutinee
26 while let 1 = (2) {} //~ ERROR unnecessary parentheses around `let` scrutinee
27 let v = X { y: false };
28 // struct lits needs parens, so these shouldn't warn.
29 if (v == X { y: true }) {}
30 if (X { y: true } == v) {}
31 if (X { y: false }.y) {}
33 while (X { y: false }.foo(true)) {}
34 while (true | X { y: false }.y) {}
36 match (X { y: false }) {
40 X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument
42 let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
43 _a = (0); //~ ERROR unnecessary parentheses around assigned value
44 _a += (1); //~ ERROR unnecessary parentheses around assigned value