Skip to content

Commit 0332a7b

Browse files
committed
Auto merge of rust-lang#87337 - jyn514:lint-error, r=oli-obk,flip1995
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes rust-lang#82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
2 parents 6536c58 + ac9dd36 commit 0332a7b

30 files changed

+123
-102
lines changed

tests/ui-toml/lint_decimal_readability/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::excessive_precision)]
12
#[deny(clippy::unreadable_literal)]
23

34
fn allow_inconsistent_digit_grouping() {

tests/ui-toml/lint_decimal_readability/test.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: digits grouped inconsistently by underscores
2-
--> $DIR/test.rs:18:18
2+
--> $DIR/test.rs:19:18
33
|
44
LL | let _fail1 = 100_200_300.123456789;
55
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`

tests/ui/deref_addrof.fixed

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ macro_rules! m_mut {
5252
};
5353
}
5454

55+
#[derive(Copy, Clone)]
5556
pub struct S;
5657
impl S {
5758
pub fn f(&self) -> &Self {
5859
m!(self)
5960
}
60-
pub fn f_mut(&self) -> &Self {
61+
#[allow(unused_mut)] // mut will be unused, once the macro is fixed
62+
pub fn f_mut(mut self) -> Self {
6163
m_mut!(self)
6264
}
6365
}

tests/ui/deref_addrof.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ macro_rules! m_mut {
5252
};
5353
}
5454

55+
#[derive(Copy, Clone)]
5556
pub struct S;
5657
impl S {
5758
pub fn f(&self) -> &Self {
5859
m!(self)
5960
}
60-
pub fn f_mut(&self) -> &Self {
61+
#[allow(unused_mut)] // mut will be unused, once the macro is fixed
62+
pub fn f_mut(mut self) -> Self {
6163
m_mut!(self)
6264
}
6365
}

tests/ui/double_neg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[warn(clippy::double_neg)]
2+
#[allow(clippy::no_effect)]
23
fn main() {
34
let x = 1;
45
-x;

tests/ui/double_neg.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op
2-
--> $DIR/double_neg.rs:6:5
2+
--> $DIR/double_neg.rs:7:5
33
|
44
LL | --x;
55
| ^^^

tests/ui/fn_params_excessive_bools.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::fn_params_excessive_bools)]
2+
#![allow(clippy::too_many_arguments)]
23

34
extern "C" {
45
fn f(_: bool, _: bool, _: bool, _: bool);

tests/ui/fn_params_excessive_bools.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: more than 3 bools in function parameters
2-
--> $DIR/fn_params_excessive_bools.rs:17:1
2+
--> $DIR/fn_params_excessive_bools.rs:18:1
33
|
44
LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,31 +8,31 @@ LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
88
= help: consider refactoring bools into two-variant enums
99

1010
error: more than 3 bools in function parameters
11-
--> $DIR/fn_params_excessive_bools.rs:20:1
11+
--> $DIR/fn_params_excessive_bools.rs:21:1
1212
|
1313
LL | fn t(_: S, _: S, _: Box<S>, _: Vec<u32>, _: bool, _: bool, _: bool, _: bool) {}
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515
|
1616
= help: consider refactoring bools into two-variant enums
1717

1818
error: more than 3 bools in function parameters
19-
--> $DIR/fn_params_excessive_bools.rs:24:5
19+
--> $DIR/fn_params_excessive_bools.rs:25:5
2020
|
2121
LL | fn f(_: bool, _: bool, _: bool, _: bool);
2222
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2323
|
2424
= help: consider refactoring bools into two-variant enums
2525

2626
error: more than 3 bools in function parameters
27-
--> $DIR/fn_params_excessive_bools.rs:29:5
27+
--> $DIR/fn_params_excessive_bools.rs:30:5
2828
|
2929
LL | fn f(&self, _: bool, _: bool, _: bool, _: bool) {}
3030
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3131
|
3232
= help: consider refactoring bools into two-variant enums
3333

3434
error: more than 3 bools in function parameters
35-
--> $DIR/fn_params_excessive_bools.rs:41:5
35+
--> $DIR/fn_params_excessive_bools.rs:42:5
3636
|
3737
LL | / fn n(_: bool, _: u32, _: bool, _: Box<u32>, _: bool, _: bool) {
3838
LL | | fn nn(_: bool, _: bool, _: bool, _: bool) {}
@@ -42,7 +42,7 @@ LL | | }
4242
= help: consider refactoring bools into two-variant enums
4343

4444
error: more than 3 bools in function parameters
45-
--> $DIR/fn_params_excessive_bools.rs:42:9
45+
--> $DIR/fn_params_excessive_bools.rs:43:9
4646
|
4747
LL | fn nn(_: bool, _: bool, _: bool, _: bool) {}
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/formatting.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![allow(unused_assignments)]
44
#![allow(clippy::if_same_then_else)]
55
#![allow(clippy::deref_addrof)]
6+
#![allow(clippy::nonminimal_bool)]
67

78
fn foo() -> bool {
89
true

tests/ui/formatting.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
2-
--> $DIR/formatting.rs:15:6
2+
--> $DIR/formatting.rs:16:6
33
|
44
LL | a =- 35;
55
| ^^^^
@@ -8,23 +8,23 @@ LL | a =- 35;
88
= note: to remove this lint, use either `-=` or `= -`
99

1010
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
11-
--> $DIR/formatting.rs:16:6
11+
--> $DIR/formatting.rs:17:6
1212
|
1313
LL | a =* &191;
1414
| ^^^^
1515
|
1616
= note: to remove this lint, use either `*=` or `= *`
1717

1818
error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)`
19-
--> $DIR/formatting.rs:19:6
19+
--> $DIR/formatting.rs:20:6
2020
|
2121
LL | b =! false;
2222
| ^^^^
2323
|
2424
= note: to remove this lint, use either `!=` or `= !`
2525

2626
error: possibly missing a comma here
27-
--> $DIR/formatting.rs:28:19
27+
--> $DIR/formatting.rs:29:19
2828
|
2929
LL | -1, -2, -3 // <= no comma here
3030
| ^
@@ -33,15 +33,15 @@ LL | -1, -2, -3 // <= no comma here
3333
= note: to remove this lint, add a comma or write the expr in a single line
3434

3535
error: possibly missing a comma here
36-
--> $DIR/formatting.rs:32:19
36+
--> $DIR/formatting.rs:33:19
3737
|
3838
LL | -1, -2, -3 // <= no comma here
3939
| ^
4040
|
4141
= note: to remove this lint, add a comma or write the expr in a single line
4242

4343
error: possibly missing a comma here
44-
--> $DIR/formatting.rs:69:11
44+
--> $DIR/formatting.rs:70:11
4545
|
4646
LL | -1
4747
| ^

0 commit comments

Comments
 (0)