1 // compile-flags: --error-format json -Zunstable-options
4 // The output for humans should just highlight the whole span without showing
5 // the suggested replacement, but we also want to test that suggested
6 // replacement only removes one set of parentheses, rather than naïvely
7 // stripping away any starting or ending parenthesis characters—hence this
8 // test of the JSON error format.
10 #![deny(unused_parens)]
11 #![allow(unreachable_code)]
17 if _b { //~ ERROR unnecessary parentheses
28 if c { //~ ERROR unnecessary parentheses
32 if c { //~ ERROR unnecessary parentheses
37 if c { //~ ERROR unnecessary parentheses
43 while true && false { //~ ERROR unnecessary parentheses
44 for _ in 0 .. 3 { //~ ERROR unnecessary parentheses
49 for _ in 0 .. 3 { //~ ERROR unnecessary parentheses
50 while true && false { //~ ERROR unnecessary parentheses
57 if (break { return true }) {