Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test style in unused parentheses lint test #65507

Merged
merged 5 commits into from
Oct 23, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replaced pretty-json error-format with only json
Lucas Henry committed Oct 17, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 46a44668b2e9a25b0e6fe8c805a76325a3c49810
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/test/ui/lint/unused_parens_remove_json_suggestion.rs
Original file line number Diff line number Diff line change
@@ -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
644 changes: 20 additions & 624 deletions src/test/ui/lint/unused_parens_remove_json_suggestion.stderr
Original file line number Diff line number Diff line change
@@ -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

"
}
"}