From b9bca1800219b908049a5cfb7cafc0322439f9a8 Mon Sep 17 00:00:00 2001 From: Lucas Henry Date: Thu, 17 Oct 2019 19:15:42 +0200 Subject: [PATCH 1/5] Replaced warn attibute by deny --- .../lint/unused_parens_json_suggestion.fixed | 5 +- .../ui/lint/unused_parens_json_suggestion.rs | 5 +- .../lint/unused_parens_json_suggestion.stderr | 50 +++++++++++-------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/test/ui/lint/unused_parens_json_suggestion.fixed b/src/test/ui/lint/unused_parens_json_suggestion.fixed index 427407119102c..7a2d9ecdc3623 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_json_suggestion.fixed @@ -1,5 +1,4 @@ // compile-flags: --error-format pretty-json -Zunstable-options -// build-pass (FIXME(62277): could be check-pass?) // run-rustfix // The output for humans should just highlight the whole span without showing @@ -8,13 +7,13 @@ // stripping away any starting or ending parenthesis characters—hence this // test of the JSON error format. -#![warn(unused_parens)] +#![deny(unused_parens)] #![allow(unreachable_code)] fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = 1 / (2 + 3); + let _a = 1 / (2 + 3); //~ERROR unused parentheses wrap expression f(); } diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index 87192503986c4..bfc649ad99c9a 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -1,5 +1,4 @@ // compile-flags: --error-format pretty-json -Zunstable-options -// build-pass (FIXME(62277): could be check-pass?) // run-rustfix // The output for humans should just highlight the whole span without showing @@ -8,13 +7,13 @@ // stripping away any starting or ending parenthesis characters—hence this // test of the JSON error format. -#![warn(unused_parens)] +#![deny(unused_parens)] #![allow(unreachable_code)] fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = (1 / (2 + 3)); + let _a = (1 / (2 + 3)); //~ERROR unused parentheses wrap expression f(); } diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index 256c7555c908b..54baade36e6ae 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -4,20 +4,20 @@ "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 654, - "byte_end": 667, - "line_start": 17, - "line_end": 17, + "byte_start": 603, + "byte_end": 616, + "line_start": 16, + "line_end": 16, "column_start": 14, "column_end": 27, "is_primary": true, "text": [ { - "text": " let _a = (1 / (2 + 3));", + "text": " let _a = (1 / (2 + 3)); "highlight_start": 14, "highlight_end": 27 } @@ -36,16 +36,16 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 472, - "byte_end": 485, - "line_start": 11, - "line_end": 11, + "byte_start": 421, + "byte_end": 434, + "line_start": 10, + "line_end": 10, "column_start": 9, "column_end": 22, "is_primary": true, "text": [ { - "text": "#![warn(unused_parens)]", + "text": "#![deny(unused_parens)]", "highlight_start": 9, "highlight_end": 22 } @@ -66,16 +66,16 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 654, - "byte_end": 667, - "line_start": 17, - "line_end": 17, + "byte_start": 603, + "byte_end": 616, + "line_start": 16, + "line_end": 16, "column_start": 14, "column_end": 27, "is_primary": true, "text": [ { - "text": " let _a = (1 / (2 + 3));", + "text": " let _a = (1 / (2 + 3)); "highlight_start": 14, "highlight_end": 27 } @@ -90,17 +90,27 @@ "rendered": null } ], - "rendered": "warning: unnecessary parentheses around assigned value - --> $DIR/unused_parens_json_suggestion.rs:17:14 + "rendered": "error: unnecessary parentheses around assigned value + --> $DIR/unused_parens_json_suggestion.rs:16:14 | LL | let _a = (1 / (2 + 3)); | ^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/unused_parens_json_suggestion.rs:11:9 + --> $DIR/unused_parens_json_suggestion.rs:10:9 | -LL | #![warn(unused_parens)] +LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ " } +{ + "message": "aborting due to previous error", + "code": null, + "level": "error", + "spans": [], + "children": [], + "rendered": "error: aborting due to previous error + +" +} From 43b5dcaabb527126830f721318037bb270e21d4a Mon Sep 17 00:00:00 2001 From: Lucas Henry Date: Thu, 17 Oct 2019 19:27:55 +0200 Subject: [PATCH 2/5] Replaced warn attribute by deny --- .../lint/unused_parens_json_suggestion.fixed | 2 +- .../ui/lint/unused_parens_json_suggestion.rs | 2 +- ...unused_parens_remove_json_suggestion.fixed | 19 +- .../unused_parens_remove_json_suggestion.rs | 19 +- ...nused_parens_remove_json_suggestion.stderr | 254 +++++++++--------- 5 files changed, 152 insertions(+), 144 deletions(-) diff --git a/src/test/ui/lint/unused_parens_json_suggestion.fixed b/src/test/ui/lint/unused_parens_json_suggestion.fixed index 7a2d9ecdc3623..5408a7cab7faa 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_json_suggestion.fixed @@ -13,7 +13,7 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = 1 / (2 + 3); //~ERROR unused parentheses wrap expression + let _a = 1 / (2 + 3); //~ERROR f(); } diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index bfc649ad99c9a..ca421523ccd35 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -13,7 +13,7 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = (1 / (2 + 3)); //~ERROR unused parentheses wrap expression + let _a = (1 / (2 + 3)); //~ERROR f(); } diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed index 2459eb1ac5cb8..d63abfc8e50de 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed @@ -1,5 +1,4 @@ // compile-flags: --error-format pretty-json -Zunstable-options -// build-pass // run-rustfix // The output for humans should just highlight the whole span without showing @@ -8,14 +7,14 @@ // stripping away any starting or ending parenthesis characters—hence this // test of the JSON error format. -#![warn(unused_parens)] +#![deny(unused_parens)] #![allow(unreachable_code)] fn main() { let _b = false; - if _b { + if _b { //~ ERROR println!("hello"); } @@ -26,29 +25,29 @@ fn main() { fn f() -> bool { let c = false; - if c { + if c { //~ ERROR println!("next"); } - if c { + if c { //~ ERROR println!("prev"); } while false && true { - if c { + if c { //~ ERROR println!("norm"); } } - while true && false { - for _ in 0 .. 3 { + while true && false { //~ ERROR + for _ in 0 .. 3 { //~ ERROR println!("e~") } } - for _ in 0 .. 3 { - while true && false { + for _ in 0 .. 3 { //~ ERROR + while true && false { //~ ERROR println!("e~") } } diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs index 0e9869b67d590..1af352df78d78 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs @@ -1,5 +1,4 @@ // compile-flags: --error-format pretty-json -Zunstable-options -// build-pass // run-rustfix // The output for humans should just highlight the whole span without showing @@ -8,14 +7,14 @@ // stripping away any starting or ending parenthesis characters—hence this // test of the JSON error format. -#![warn(unused_parens)] +#![deny(unused_parens)] #![allow(unreachable_code)] fn main() { let _b = false; - if (_b) { + if (_b) { //~ ERROR println!("hello"); } @@ -26,29 +25,29 @@ fn main() { fn f() -> bool { let c = false; - if(c) { + if(c) { //~ ERROR println!("next"); } - if (c){ + if (c){ //~ ERROR println!("prev"); } while (false && true){ - if (c) { + if (c) { //~ ERROR println!("norm"); } } - while(true && false) { - for _ in (0 .. 3){ + while(true && false) { //~ ERROR + for _ in (0 .. 3){ //~ ERROR println!("e~") } } - for _ in (0 .. 3) { - while (true && false) { + for _ in (0 .. 3) { //~ ERROR + while (true && false) { //~ ERROR println!("e~") } } diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr index b4eab200dd016..3665d94cca204 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -4,20 +4,20 @@ "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 521, - "byte_end": 525, - "line_start": 18, - "line_end": 18, + "byte_start": 507, + "byte_end": 511, + "line_start": 17, + "line_end": 17, "column_start": 8, "column_end": 12, "is_primary": true, "text": [ { - "text": " if (_b) {", + "text": " if (_b) { "highlight_start": 8, "highlight_end": 12 } @@ -36,16 +36,16 @@ "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 435, - "byte_end": 448, - "line_start": 11, - "line_end": 11, + "byte_start": 421, + "byte_end": 434, + "line_start": 10, + "line_end": 10, "column_start": 9, "column_end": 22, "is_primary": true, "text": [ { - "text": "#![warn(unused_parens)]", + "text": "#![deny(unused_parens)]", "highlight_start": 9, "highlight_end": 22 } @@ -66,16 +66,16 @@ "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 521, - "byte_end": 525, - "line_start": 18, - "line_end": 18, + "byte_start": 507, + "byte_end": 511, + "line_start": 17, + "line_end": 17, "column_start": 8, "column_end": 12, "is_primary": true, "text": [ { - "text": " if (_b) {", + "text": " if (_b) { "highlight_start": 8, "highlight_end": 12 } @@ -90,16 +90,16 @@ "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `if` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:18:8 + "rendered": "error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:17:8 | LL | if (_b) { | ^^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/unused_parens_remove_json_suggestion.rs:11:9 + --> $DIR/unused_parens_remove_json_suggestion.rs:10:9 | -LL | #![warn(unused_parens)] +LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ " @@ -110,20 +110,20 @@ LL | #![warn(unused_parens)] "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 618, - "byte_end": 621, - "line_start": 29, - "line_end": 29, + "byte_start": 614, + "byte_end": 617, + "line_start": 28, + "line_end": 28, "column_start": 7, "column_end": 10, "is_primary": true, "text": [ { - "text": " if(c) {", + "text": " if(c) { "highlight_start": 7, "highlight_end": 10 } @@ -142,16 +142,16 @@ LL | #![warn(unused_parens)] "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 618, - "byte_end": 621, - "line_start": 29, - "line_end": 29, + "byte_start": 614, + "byte_end": 617, + "line_start": 28, + "line_end": 28, "column_start": 7, "column_end": 10, "is_primary": true, "text": [ { - "text": " if(c) {", + "text": " if(c) { "highlight_start": 7, "highlight_end": 10 } @@ -166,8 +166,8 @@ LL | #![warn(unused_parens)] "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `if` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:29:7 + "rendered": "error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:28:7 | LL | if(c) { | ^^^ help: remove these parentheses @@ -180,20 +180,20 @@ LL | if(c) { "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 664, - "byte_end": 667, - "line_start": 33, - "line_end": 33, + "byte_start": 670, + "byte_end": 673, + "line_start": 32, + "line_end": 32, "column_start": 8, "column_end": 11, "is_primary": true, "text": [ { - "text": " if (c){", + "text": " if (c){ "highlight_start": 8, "highlight_end": 11 } @@ -212,16 +212,16 @@ LL | if(c) { "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 664, - "byte_end": 667, - "line_start": 33, - "line_end": 33, + "byte_start": 670, + "byte_end": 673, + "line_start": 32, + "line_end": 32, "column_start": 8, "column_end": 11, "is_primary": true, "text": [ { - "text": " if (c){", + "text": " if (c){ "highlight_start": 8, "highlight_end": 11 } @@ -236,8 +236,8 @@ LL | if(c) { "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `if` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:33:8 + "rendered": "error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:32:8 | LL | if (c){ | ^^^ help: remove these parentheses @@ -250,14 +250,14 @@ LL | if (c){ "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 712, - "byte_end": 727, - "line_start": 37, - "line_end": 37, + "byte_start": 728, + "byte_end": 743, + "line_start": 36, + "line_end": 36, "column_start": 11, "column_end": 26, "is_primary": true, @@ -282,10 +282,10 @@ LL | if (c){ "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 712, - "byte_end": 727, - "line_start": 37, - "line_end": 37, + "byte_start": 728, + "byte_end": 743, + "line_start": 36, + "line_end": 36, "column_start": 11, "column_end": 26, "is_primary": true, @@ -306,8 +306,8 @@ LL | if (c){ "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `while` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:37:11 + "rendered": "error: unnecessary parentheses around `while` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:36:11 | LL | while (false && true){ | ^^^^^^^^^^^^^^^ help: remove these parentheses @@ -320,20 +320,20 @@ LL | while (false && true){ "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 740, - "byte_end": 743, - "line_start": 38, - "line_end": 38, + "byte_start": 756, + "byte_end": 759, + "line_start": 37, + "line_end": 37, "column_start": 12, "column_end": 15, "is_primary": true, "text": [ { - "text": " if (c) {", + "text": " if (c) { "highlight_start": 12, "highlight_end": 15 } @@ -352,16 +352,16 @@ LL | while (false && true){ "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 740, - "byte_end": 743, - "line_start": 38, - "line_end": 38, + "byte_start": 756, + "byte_end": 759, + "line_start": 37, + "line_end": 37, "column_start": 12, "column_end": 15, "is_primary": true, "text": [ { - "text": " if (c) {", + "text": " if (c) { "highlight_start": 12, "highlight_end": 15 } @@ -376,8 +376,8 @@ LL | while (false && true){ "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `if` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:38:12 + "rendered": "error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:37:12 | LL | if (c) { | ^^^ help: remove these parentheses @@ -390,20 +390,20 @@ LL | if (c) { "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 803, - "byte_end": 818, - "line_start": 44, - "line_end": 44, + "byte_start": 829, + "byte_end": 844, + "line_start": 43, + "line_end": 43, "column_start": 10, "column_end": 25, "is_primary": true, "text": [ { - "text": " while(true && false) {", + "text": " while(true && false) { "highlight_start": 10, "highlight_end": 25 } @@ -422,16 +422,16 @@ LL | if (c) { "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 803, - "byte_end": 818, - "line_start": 44, - "line_end": 44, + "byte_start": 829, + "byte_end": 844, + "line_start": 43, + "line_end": 43, "column_start": 10, "column_end": 25, "is_primary": true, "text": [ { - "text": " while(true && false) {", + "text": " while(true && false) { "highlight_start": 10, "highlight_end": 25 } @@ -446,8 +446,8 @@ LL | if (c) { "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `while` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:44:10 + "rendered": "error: unnecessary parentheses around `while` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:43:10 | LL | while(true && false) { | ^^^^^^^^^^^^^^^ help: remove these parentheses @@ -460,20 +460,20 @@ LL | while(true && false) { "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 838, - "byte_end": 846, - "line_start": 45, - "line_end": 45, + "byte_start": 874, + "byte_end": 882, + "line_start": 44, + "line_end": 44, "column_start": 18, "column_end": 26, "is_primary": true, "text": [ { - "text": " for _ in (0 .. 3){", + "text": " for _ in (0 .. 3){ "highlight_start": 18, "highlight_end": 26 } @@ -492,16 +492,16 @@ LL | while(true && false) { "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 838, - "byte_end": 846, - "line_start": 45, - "line_end": 45, + "byte_start": 874, + "byte_end": 882, + "line_start": 44, + "line_end": 44, "column_start": 18, "column_end": 26, "is_primary": true, "text": [ { - "text": " for _ in (0 .. 3){", + "text": " for _ in (0 .. 3){ "highlight_start": 18, "highlight_end": 26 } @@ -516,8 +516,8 @@ LL | while(true && false) { "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `for` head expression - --> $DIR/unused_parens_remove_json_suggestion.rs:45:18 + "rendered": "error: unnecessary parentheses around `for` head expression + --> $DIR/unused_parens_remove_json_suggestion.rs:44:18 | LL | for _ in (0 .. 3){ | ^^^^^^^^ help: remove these parentheses @@ -530,20 +530,20 @@ LL | for _ in (0 .. 3){ "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 905, - "byte_end": 913, - "line_start": 50, - "line_end": 50, + "byte_start": 951, + "byte_end": 959, + "line_start": 49, + "line_end": 49, "column_start": 14, "column_end": 22, "is_primary": true, "text": [ { - "text": " for _ in (0 .. 3) {", + "text": " for _ in (0 .. 3) { "highlight_start": 14, "highlight_end": 22 } @@ -562,16 +562,16 @@ LL | for _ in (0 .. 3){ "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 905, - "byte_end": 913, - "line_start": 50, - "line_end": 50, + "byte_start": 951, + "byte_end": 959, + "line_start": 49, + "line_end": 49, "column_start": 14, "column_end": 22, "is_primary": true, "text": [ { - "text": " for _ in (0 .. 3) {", + "text": " for _ in (0 .. 3) { "highlight_start": 14, "highlight_end": 22 } @@ -586,8 +586,8 @@ LL | for _ in (0 .. 3){ "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `for` head expression - --> $DIR/unused_parens_remove_json_suggestion.rs:50:14 + "rendered": "error: unnecessary parentheses around `for` head expression + --> $DIR/unused_parens_remove_json_suggestion.rs:49:14 | LL | for _ in (0 .. 3) { | ^^^^^^^^ help: remove these parentheses @@ -600,20 +600,20 @@ LL | for _ in (0 .. 3) { "code": "unused_parens", "explanation": null }, - "level": "warning", + "level": "error", "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 930, - "byte_end": 945, - "line_start": 51, - "line_end": 51, + "byte_start": 986, + "byte_end": 1001, + "line_start": 50, + "line_end": 50, "column_start": 15, "column_end": 30, "is_primary": true, "text": [ { - "text": " while (true && false) {", + "text": " while (true && false) { "highlight_start": 15, "highlight_end": 30 } @@ -632,16 +632,16 @@ LL | for _ in (0 .. 3) { "spans": [ { "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 930, - "byte_end": 945, - "line_start": 51, - "line_end": 51, + "byte_start": 986, + "byte_end": 1001, + "line_start": 50, + "line_end": 50, "column_start": 15, "column_end": 30, "is_primary": true, "text": [ { - "text": " while (true && false) {", + "text": " while (true && false) { "highlight_start": 15, "highlight_end": 30 } @@ -656,11 +656,21 @@ LL | for _ in (0 .. 3) { "rendered": null } ], - "rendered": "warning: unnecessary parentheses around `while` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:51:15 + "rendered": "error: unnecessary parentheses around `while` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:50:15 | LL | while (true && false) { | ^^^^^^^^^^^^^^^ help: remove these parentheses " } +{ + "message": "aborting due to 9 previous errors", + "code": null, + "level": "error", + "spans": [], + "children": [], + "rendered": "error: aborting due to 9 previous errors + +" +} From 46a44668b2e9a25b0e6fe8c805a76325a3c49810 Mon Sep 17 00:00:00 2001 From: Lucas Henry Date: Thu, 17 Oct 2019 19:31:37 +0200 Subject: [PATCH 3/5] Replaced pretty-json error-format with only json --- ...unused_parens_remove_json_suggestion.fixed | 2 +- .../unused_parens_remove_json_suggestion.rs | 2 +- ...nused_parens_remove_json_suggestion.stderr | 644 +----------------- 3 files changed, 22 insertions(+), 626 deletions(-) diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed index d63abfc8e50de..4497a159f64d7 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed @@ -1,4 +1,4 @@ -// compile-flags: --error-format pretty-json -Zunstable-options +// compile-flags: --error-format json -Zunstable-options // run-rustfix // The output for humans should just highlight the whole span without showing diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs index 1af352df78d78..22539b34bce17 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs @@ -1,4 +1,4 @@ -// compile-flags: --error-format pretty-json -Zunstable-options +// compile-flags: --error-format json -Zunstable-options // run-rustfix // The output for humans should just highlight the whole span without showing diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr index 3665d94cca204..6901ac09f9917 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -1,96 +1,4 @@ -{ - "message": "unnecessary parentheses around `if` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 507, - "byte_end": 511, - "line_start": 17, - "line_end": 17, - "column_start": 8, - "column_end": 12, - "is_primary": true, - "text": [ - { - "text": " if (_b) { - "highlight_start": 8, - "highlight_end": 12 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "lint level defined here", - "code": null, - "level": "note", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 421, - "byte_end": 434, - "line_start": 10, - "line_end": 10, - "column_start": 9, - "column_end": 22, - "is_primary": true, - "text": [ - { - "text": "#![deny(unused_parens)]", - "highlight_start": 9, - "highlight_end": 22 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [], - "rendered": null - }, - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 507, - "byte_end": 511, - "line_start": 17, - "line_end": 17, - "column_start": 8, - "column_end": 12, - "is_primary": true, - "text": [ - { - "text": " if (_b) { - "highlight_start": 8, - "highlight_end": 12 - } - ], - "label": null, - "suggested_replacement": "_b", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `if` condition +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":500,"byte_end":504,"line_start":17,"line_end":17,"column_start":8,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) { --> $DIR/unused_parens_remove_json_suggestion.rs:17:8 | LL | if (_b) { @@ -102,575 +10,63 @@ note: lint level defined here LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ -" -} -{ - "message": "unnecessary parentheses around `if` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 614, - "byte_end": 617, - "line_start": 28, - "line_end": 28, - "column_start": 7, - "column_end": 10, - "is_primary": true, - "text": [ - { - "text": " if(c) { - "highlight_start": 7, - "highlight_end": 10 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 614, - "byte_end": 617, - "line_start": 28, - "line_end": 28, - "column_start": 7, - "column_end": 10, - "is_primary": true, - "text": [ - { - "text": " if(c) { - "highlight_start": 7, - "highlight_end": 10 - } - ], - "label": null, - "suggested_replacement": " c", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `if` condition +"} +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":607,"byte_end":610,"line_start":28,"line_end":28,"column_start":7,"column_end":10,"is_primary":true,"text":[{"text":" if(c) { --> $DIR/unused_parens_remove_json_suggestion.rs:28:7 | LL | if(c) { | ^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `if` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 670, - "byte_end": 673, - "line_start": 32, - "line_end": 32, - "column_start": 8, - "column_end": 11, - "is_primary": true, - "text": [ - { - "text": " if (c){ - "highlight_start": 8, - "highlight_end": 11 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 670, - "byte_end": 673, - "line_start": 32, - "line_end": 32, - "column_start": 8, - "column_end": 11, - "is_primary": true, - "text": [ - { - "text": " if (c){ - "highlight_start": 8, - "highlight_end": 11 - } - ], - "label": null, - "suggested_replacement": "c ", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `if` condition +"} +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":663,"byte_end":666,"line_start":32,"line_end":32,"column_start":8,"column_end":11,"is_primary":true,"text":[{"text":" if (c){ --> $DIR/unused_parens_remove_json_suggestion.rs:32:8 | LL | if (c){ | ^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `while` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 728, - "byte_end": 743, - "line_start": 36, - "line_end": 36, - "column_start": 11, - "column_end": 26, - "is_primary": true, - "text": [ - { - "text": " while (false && true){", - "highlight_start": 11, - "highlight_end": 26 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 728, - "byte_end": 743, - "line_start": 36, - "line_end": 36, - "column_start": 11, - "column_end": 26, - "is_primary": true, - "text": [ - { - "text": " while (false && true){", - "highlight_start": 11, - "highlight_end": 26 - } - ], - "label": null, - "suggested_replacement": "false && true ", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `while` condition +"} +{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":721,"byte_end":736,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":721,"byte_end":736,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":"false && true ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition --> $DIR/unused_parens_remove_json_suggestion.rs:36:11 | LL | while (false && true){ | ^^^^^^^^^^^^^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `if` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 756, - "byte_end": 759, - "line_start": 37, - "line_end": 37, - "column_start": 12, - "column_end": 15, - "is_primary": true, - "text": [ - { - "text": " if (c) { - "highlight_start": 12, - "highlight_end": 15 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 756, - "byte_end": 759, - "line_start": 37, - "line_end": 37, - "column_start": 12, - "column_end": 15, - "is_primary": true, - "text": [ - { - "text": " if (c) { - "highlight_start": 12, - "highlight_end": 15 - } - ], - "label": null, - "suggested_replacement": "c", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `if` condition +"} +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":749,"byte_end":752,"line_start":37,"line_end":37,"column_start":12,"column_end":15,"is_primary":true,"text":[{"text":" if (c) { --> $DIR/unused_parens_remove_json_suggestion.rs:37:12 | LL | if (c) { | ^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `while` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 829, - "byte_end": 844, - "line_start": 43, - "line_end": 43, - "column_start": 10, - "column_end": 25, - "is_primary": true, - "text": [ - { - "text": " while(true && false) { - "highlight_start": 10, - "highlight_end": 25 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 829, - "byte_end": 844, - "line_start": 43, - "line_end": 43, - "column_start": 10, - "column_end": 25, - "is_primary": true, - "text": [ - { - "text": " while(true && false) { - "highlight_start": 10, - "highlight_end": 25 - } - ], - "label": null, - "suggested_replacement": " true && false", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `while` condition +"} +{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":822,"byte_end":837,"line_start":43,"line_end":43,"column_start":10,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) { --> $DIR/unused_parens_remove_json_suggestion.rs:43:10 | LL | while(true && false) { | ^^^^^^^^^^^^^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `for` head expression", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 874, - "byte_end": 882, - "line_start": 44, - "line_end": 44, - "column_start": 18, - "column_end": 26, - "is_primary": true, - "text": [ - { - "text": " for _ in (0 .. 3){ - "highlight_start": 18, - "highlight_end": 26 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 874, - "byte_end": 882, - "line_start": 44, - "line_end": 44, - "column_start": 18, - "column_end": 26, - "is_primary": true, - "text": [ - { - "text": " for _ in (0 .. 3){ - "highlight_start": 18, - "highlight_end": 26 - } - ], - "label": null, - "suggested_replacement": "0 .. 3 ", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `for` head expression +"} +{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":867,"byte_end":875,"line_start":44,"line_end":44,"column_start":18,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){ --> $DIR/unused_parens_remove_json_suggestion.rs:44:18 | LL | for _ in (0 .. 3){ | ^^^^^^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `for` head expression", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 951, - "byte_end": 959, - "line_start": 49, - "line_end": 49, - "column_start": 14, - "column_end": 22, - "is_primary": true, - "text": [ - { - "text": " for _ in (0 .. 3) { - "highlight_start": 14, - "highlight_end": 22 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 951, - "byte_end": 959, - "line_start": 49, - "line_end": 49, - "column_start": 14, - "column_end": 22, - "is_primary": true, - "text": [ - { - "text": " for _ in (0 .. 3) { - "highlight_start": 14, - "highlight_end": 22 - } - ], - "label": null, - "suggested_replacement": "0 .. 3", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `for` head expression +"} +{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":944,"byte_end":952,"line_start":49,"line_end":49,"column_start":14,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) { --> $DIR/unused_parens_remove_json_suggestion.rs:49:14 | LL | for _ in (0 .. 3) { | ^^^^^^^^ help: remove these parentheses -" -} -{ - "message": "unnecessary parentheses around `while` condition", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 986, - "byte_end": 1001, - "line_start": 50, - "line_end": 50, - "column_start": 15, - "column_end": 30, - "is_primary": true, - "text": [ - { - "text": " while (true && false) { - "highlight_start": 15, - "highlight_end": 30 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_remove_json_suggestion.rs", - "byte_start": 986, - "byte_end": 1001, - "line_start": 50, - "line_end": 50, - "column_start": 15, - "column_end": 30, - "is_primary": true, - "text": [ - { - "text": " while (true && false) { - "highlight_start": 15, - "highlight_end": 30 - } - ], - "label": null, - "suggested_replacement": "true && false", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around `while` condition +"} +{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":979,"byte_end":994,"line_start":50,"line_end":50,"column_start":15,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) { --> $DIR/unused_parens_remove_json_suggestion.rs:50:15 | LL | while (true && false) { | ^^^^^^^^^^^^^^^ help: remove these parentheses -" -} -{ - "message": "aborting due to 9 previous errors", - "code": null, - "level": "error", - "spans": [], - "children": [], - "rendered": "error: aborting due to 9 previous errors +"} +{"message":"aborting due to 9 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 9 previous errors -" -} +"} From a1387e352f36ae6cd80ee25e01a4a6de2aedef45 Mon Sep 17 00:00:00 2001 From: Lucas Henry Date: Thu, 17 Oct 2019 19:32:04 +0200 Subject: [PATCH 4/5] Replaced pretty-json error-format with only json --- .../lint/unused_parens_json_suggestion.fixed | 2 +- .../ui/lint/unused_parens_json_suggestion.rs | 2 +- .../lint/unused_parens_json_suggestion.stderr | 108 +----------------- 3 files changed, 6 insertions(+), 106 deletions(-) diff --git a/src/test/ui/lint/unused_parens_json_suggestion.fixed b/src/test/ui/lint/unused_parens_json_suggestion.fixed index 5408a7cab7faa..757ad933a1f70 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_json_suggestion.fixed @@ -1,4 +1,4 @@ -// compile-flags: --error-format pretty-json -Zunstable-options +// compile-flags: --error-format json -Zunstable-options // run-rustfix // The output for humans should just highlight the whole span without showing diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index ca421523ccd35..173cd55545027 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -1,4 +1,4 @@ -// compile-flags: --error-format pretty-json -Zunstable-options +// compile-flags: --error-format json -Zunstable-options // run-rustfix // The output for humans should just highlight the whole span without showing diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index 54baade36e6ae..c503c100808db 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -1,96 +1,4 @@ -{ - "message": "unnecessary parentheses around assigned value", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 603, - "byte_end": 616, - "line_start": 16, - "line_end": 16, - "column_start": 14, - "column_end": 27, - "is_primary": true, - "text": [ - { - "text": " let _a = (1 / (2 + 3)); - "highlight_start": 14, - "highlight_end": 27 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "lint level defined here", - "code": null, - "level": "note", - "spans": [ - { - "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 421, - "byte_end": 434, - "line_start": 10, - "line_end": 10, - "column_start": 9, - "column_end": 22, - "is_primary": true, - "text": [ - { - "text": "#![deny(unused_parens)]", - "highlight_start": 9, - "highlight_end": 22 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [], - "rendered": null - }, - { - "message": "remove these parentheses", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 603, - "byte_end": 616, - "line_start": 16, - "line_end": 16, - "column_start": 14, - "column_end": 27, - "is_primary": true, - "text": [ - { - "text": " let _a = (1 / (2 + 3)); - "highlight_start": 14, - "highlight_end": 27 - } - ], - "label": null, - "suggested_replacement": "1 / (2 + 3)", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "error: unnecessary parentheses around assigned value +{"message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":596,"byte_end":609,"line_start":16,"line_end":16,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3)); --> $DIR/unused_parens_json_suggestion.rs:16:14 | LL | let _a = (1 / (2 + 3)); @@ -102,15 +10,7 @@ note: lint level defined here LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ -" -} -{ - "message": "aborting due to previous error", - "code": null, - "level": "error", - "spans": [], - "children": [], - "rendered": "error: aborting due to previous error +"} +{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error -" -} +"} From 95d98af806f78d9cbe3975b633d5341394a155ad Mon Sep 17 00:00:00 2001 From: Lucas Henry Date: Fri, 18 Oct 2019 13:21:39 +0200 Subject: [PATCH 5/5] Added text after error messages --- .../ui/lint/unused_parens_json_suggestion.fixed | 2 +- .../ui/lint/unused_parens_json_suggestion.rs | 2 +- .../unused_parens_remove_json_suggestion.fixed | 16 ++++++++-------- .../lint/unused_parens_remove_json_suggestion.rs | 16 ++++++++-------- .../unused_parens_remove_json_suggestion.stderr | 16 ++++++++-------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/test/ui/lint/unused_parens_json_suggestion.fixed b/src/test/ui/lint/unused_parens_json_suggestion.fixed index 757ad933a1f70..15ee19755bffc 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_json_suggestion.fixed @@ -13,7 +13,7 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = 1 / (2 + 3); //~ERROR + let _a = 1 / (2 + 3); //~ERROR unnecessary parentheses f(); } diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index 173cd55545027..d72df21e09ae2 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -13,7 +13,7 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = (1 / (2 + 3)); //~ERROR + let _a = (1 / (2 + 3)); //~ERROR unnecessary parentheses f(); } diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed index 4497a159f64d7..1d891d328dd5a 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed @@ -14,7 +14,7 @@ fn main() { let _b = false; - if _b { //~ ERROR + if _b { //~ ERROR unnecessary parentheses println!("hello"); } @@ -25,29 +25,29 @@ fn main() { fn f() -> bool { let c = false; - if c { //~ ERROR + if c { //~ ERROR unnecessary parentheses println!("next"); } - if c { //~ ERROR + if c { //~ ERROR unnecessary parentheses println!("prev"); } while false && true { - if c { //~ ERROR + if c { //~ ERROR unnecessary parentheses println!("norm"); } } - while true && false { //~ ERROR - for _ in 0 .. 3 { //~ ERROR + while true && false { //~ ERROR unnecessary parentheses + for _ in 0 .. 3 { //~ ERROR unnecessary parentheses println!("e~") } } - for _ in 0 .. 3 { //~ ERROR - while true && false { //~ ERROR + for _ in 0 .. 3 { //~ ERROR unnecessary parentheses + while true && false { //~ ERROR unnecessary parentheses println!("e~") } } diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs index 22539b34bce17..494cd18450630 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs @@ -14,7 +14,7 @@ fn main() { let _b = false; - if (_b) { //~ ERROR + if (_b) { //~ ERROR unnecessary parentheses println!("hello"); } @@ -25,29 +25,29 @@ fn main() { fn f() -> bool { let c = false; - if(c) { //~ ERROR + if(c) { //~ ERROR unnecessary parentheses println!("next"); } - if (c){ //~ ERROR + if (c){ //~ ERROR unnecessary parentheses println!("prev"); } while (false && true){ - if (c) { //~ ERROR + if (c) { //~ ERROR unnecessary parentheses println!("norm"); } } - while(true && false) { //~ ERROR - for _ in (0 .. 3){ //~ ERROR + while(true && false) { //~ ERROR unnecessary parentheses + for _ in (0 .. 3){ //~ ERROR unnecessary parentheses println!("e~") } } - for _ in (0 .. 3) { //~ ERROR - while (true && false) { //~ ERROR + for _ in (0 .. 3) { //~ ERROR unnecessary parentheses + while (true && false) { //~ ERROR unnecessary parentheses println!("e~") } } diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr index 6901ac09f9917..873f105435e08 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -11,56 +11,56 @@ LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ "} -{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":607,"byte_end":610,"line_start":28,"line_end":28,"column_start":7,"column_end":10,"is_primary":true,"text":[{"text":" if(c) { +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":631,"byte_end":634,"line_start":28,"line_end":28,"column_start":7,"column_end":10,"is_primary":true,"text":[{"text":" if(c) { --> $DIR/unused_parens_remove_json_suggestion.rs:28:7 | LL | if(c) { | ^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":663,"byte_end":666,"line_start":32,"line_end":32,"column_start":8,"column_end":11,"is_primary":true,"text":[{"text":" if (c){ +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":711,"byte_end":714,"line_start":32,"line_end":32,"column_start":8,"column_end":11,"is_primary":true,"text":[{"text":" if (c){ --> $DIR/unused_parens_remove_json_suggestion.rs:32:8 | LL | if (c){ | ^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":721,"byte_end":736,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":721,"byte_end":736,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":"false && true ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition +{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":808,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":808,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":"false && true ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition --> $DIR/unused_parens_remove_json_suggestion.rs:36:11 | LL | while (false && true){ | ^^^^^^^^^^^^^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":749,"byte_end":752,"line_start":37,"line_end":37,"column_start":12,"column_end":15,"is_primary":true,"text":[{"text":" if (c) { +{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":821,"byte_end":824,"line_start":37,"line_end":37,"column_start":12,"column_end":15,"is_primary":true,"text":[{"text":" if (c) { --> $DIR/unused_parens_remove_json_suggestion.rs:37:12 | LL | if (c) { | ^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":822,"byte_end":837,"line_start":43,"line_end":43,"column_start":10,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) { +{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":918,"byte_end":933,"line_start":43,"line_end":43,"column_start":10,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) { --> $DIR/unused_parens_remove_json_suggestion.rs:43:10 | LL | while(true && false) { | ^^^^^^^^^^^^^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":867,"byte_end":875,"line_start":44,"line_end":44,"column_start":18,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){ +{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":987,"byte_end":995,"line_start":44,"line_end":44,"column_start":18,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){ --> $DIR/unused_parens_remove_json_suggestion.rs:44:18 | LL | for _ in (0 .. 3){ | ^^^^^^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":944,"byte_end":952,"line_start":49,"line_end":49,"column_start":14,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) { +{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1088,"byte_end":1096,"line_start":49,"line_end":49,"column_start":14,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) { --> $DIR/unused_parens_remove_json_suggestion.rs:49:14 | LL | for _ in (0 .. 3) { | ^^^^^^^^ help: remove these parentheses "} -{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":979,"byte_end":994,"line_start":50,"line_end":50,"column_start":15,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) { +{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1147,"byte_end":1162,"line_start":50,"line_end":50,"column_start":15,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) { --> $DIR/unused_parens_remove_json_suggestion.rs:50:15 | LL | while (true && false) {