]>
Commit | Line | Data |
---|---|---|
3c0e092e | 1 | // compile-flags: --error-format json |
416331ca | 2 | // run-rustfix |
ea8adc8c XL |
3 | |
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. | |
9 | ||
e74abb32 | 10 | #![deny(unused_parens)] |
416331ca | 11 | #![allow(unreachable_code)] |
abe05a73 | 12 | |
ea8adc8c XL |
13 | fn main() { |
14 | // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not | |
15 | // the malformed `1 / (2 + 3` | |
e74abb32 | 16 | let _a = (1 / (2 + 3)); //~ERROR unnecessary parentheses |
a1dfa0c6 XL |
17 | f(); |
18 | } | |
19 | ||
20 | fn f() -> bool { | |
21 | loop { | |
22 | if (break { return true }) { | |
23 | } | |
24 | } | |
25 | false | |
ea8adc8c | 26 | } |