diff --git a/src/test/ui/lint/unused_parens_json_suggestion.fixed b/src/test/ui/lint/unused_parens_json_suggestion.fixed index 427407119102c..a58f616872245 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?) +// compile-flags: --error-format json -Zunstable-options // 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..b9d4175a8cbb3 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?) +// compile-flags: --error-format json -Zunstable-options // 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..c503c100808db 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -1,106 +1,16 @@ -{ - "message": "unnecessary parentheses around assigned value", - "code": { - "code": "unused_parens", - "explanation": null - }, - "level": "warning", - "spans": [ - { - "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 654, - "byte_end": 667, - "line_start": 17, - "line_end": 17, - "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": 472, - "byte_end": 485, - "line_start": 11, - "line_end": 11, - "column_start": 9, - "column_end": 22, - "is_primary": true, - "text": [ - { - "text": "#![warn(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": 654, - "byte_end": 667, - "line_start": 17, - "line_end": 17, - "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": "warning: unnecessary parentheses around assigned value - --> $DIR/unused_parens_json_suggestion.rs:17:14 +{"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)); | ^^^^^^^^^^^^^ 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 + +"} diff --git a/src/test/ui/lint/use_suggestion_json.rs b/src/test/ui/lint/use_suggestion_json.rs index 1828b8c2dc735..6583001acd236 100644 --- a/src/test/ui/lint/use_suggestion_json.rs +++ b/src/test/ui/lint/use_suggestion_json.rs @@ -1,6 +1,6 @@ // ignore-cloudabi // ignore-windows -// compile-flags: --error-format pretty-json --json=diagnostic-rendered-ansi +// compile-flags: --error-format json --json=diagnostic-rendered-ansi // The output for humans should just highlight the whole span without showing // the suggested replacement, but we also want to test that suggested diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index 678c88849b561..e06c23f78b720 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -1,8 +1,4 @@ -{ - "message": "cannot find type `Iter` in this scope", - "code": { - "code": "E0412", - "explanation": " +{"message":"cannot find type `Iter` in this scope","code":{"code":"E0412","explanation":" The type name used is not in scope. Erroneous code examples: @@ -67,320 +63,31 @@ mod foo { } # fn main() {} // don't insert it for us; that'll break imports ``` -" - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 471, - "byte_end": 475, - "line_start": 12, - "line_end": 12, - "column_start": 12, - "column_end": 16, - "is_primary": true, - "text": [ - { - "text": " let x: Iter;", - "highlight_start": 12, - "highlight_end": 16 - } - ], - "label": "not found in this scope", - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "possible candidates are found in other modules, you can import them into scope", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::binary_heap::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::btree_map::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::btree_set::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::hash_map::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::hash_set::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::linked_list::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::vec_deque::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::option::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::path::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::result::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::slice::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 448, - "byte_end": 448, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::sync::mpsc::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `Iter` in this scope\u001b[0m +"},"level":"error","spans":[{"file_name":"$DIR/use_suggestion_json.rs","byte_start":464,"byte_end":468,"line_start":12,"line_end":12,"column_start":12,"column_end":16,"is_primary":true,"text":[{"text":" let x: Iter;","highlight_start":12,"highlight_end":16}],"label":"not found in this scope","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"possible candidates are found in other modules, you can import them into scope","code":null,"level":"help","spans":[{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::binary_heap::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::btree_map::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::btree_set::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::hash_map::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::hash_set::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::linked_list::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::collections::vec_deque::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::option::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::path::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::result::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::slice::Iter; + +","suggestion_applicability":"Unspecified","expansion":null},{"file_name":"$DIR/use_suggestion_json.rs","byte_start":441,"byte_end":441,"line_start":11,"line_end":11,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"fn main() {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::sync::mpsc::Iter; + +","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `Iter` in this scope\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0m$DIR/use_suggestion_json.rs:12:12\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let x: Iter;\u001b[0m @@ -397,24 +104,9 @@ mod foo { \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0mand 8 other candidates\u001b[0m -" -} -{ - "message": "aborting due to previous error", - "code": null, - "level": "error", - "spans": [], - "children": [], - "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to previous error\u001b[0m - -" -} -{ - "message": "For more information about this error, try `rustc --explain E0412`.", - "code": null, - "level": "failure-note", - "spans": [], - "children": [], - "rendered": "\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0412`.\u001b[0m -" -} +"} +{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to previous error\u001b[0m + +"} +{"message":"For more information about this error, try `rustc --explain E0412`.","code":null,"level":"","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0412`.\u001b[0m +"}