Replaced warn attribute by deny

This commit is contained in:
Lucas Henry 2019-10-17 19:27:55 +02:00
parent b9bca18002
commit 43b5dcaabb
5 changed files with 152 additions and 144 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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~")
}
}

View File

@ -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~")
}
}

View File

@ -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
"
}