]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/unused_parens_json_suggestion.rs
forward read_c_str method from Memory to Alloc
[rust.git] / src / test / ui / lint / unused_parens_json_suggestion.rs
1 // compile-flags: --error-format pretty-json -Zunstable-options
2 // compile-pass
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
10 #![warn(unused_parens)]
11
12 fn main() {
13     // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
14     // the malformed `1 / (2 + 3`
15     let _a = (1 / (2 + 3));
16     f();
17 }
18
19 fn f() -> bool {
20     loop {
21         if (break { return true }) {
22         }
23     }
24     false
25 }