Skip to content

Commit f666fd6

Browse files
Update UI tests
1 parent 95c6866 commit f666fd6

File tree

2,287 files changed

+28709
-15122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,287 files changed

+28709
-15122
lines changed

tests/ui/absurd-extreme-comparisons.rs

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,64 @@ fn main() {
1212
const Z: u32 = 0;
1313
let u: u32 = 42;
1414
u <= 0;
15-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
15+
//~^ absurd_extreme_comparisons
16+
1617
u <= Z;
17-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
18+
//~^ absurd_extreme_comparisons
19+
1820
u < Z;
19-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
21+
//~^ absurd_extreme_comparisons
22+
2023
Z >= u;
21-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
24+
//~^ absurd_extreme_comparisons
25+
2226
Z > u;
23-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
27+
//~^ absurd_extreme_comparisons
28+
2429
u > u32::MAX;
25-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
30+
//~^ absurd_extreme_comparisons
31+
2632
u >= u32::MAX;
27-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
33+
//~^ absurd_extreme_comparisons
34+
2835
u32::MAX < u;
29-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
36+
//~^ absurd_extreme_comparisons
37+
3038
u32::MAX <= u;
31-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
39+
//~^ absurd_extreme_comparisons
40+
3241
1-1 > u;
33-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
42+
//~^ absurd_extreme_comparisons
43+
3444
u >= !0;
35-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
45+
//~^ absurd_extreme_comparisons
46+
3647
u <= 12 - 2*6;
37-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
48+
//~^ absurd_extreme_comparisons
49+
3850
let i: i8 = 0;
3951
i < -127 - 1;
40-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
52+
//~^ absurd_extreme_comparisons
53+
4154
i8::MAX >= i;
42-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
55+
//~^ absurd_extreme_comparisons
56+
4357
3-7 < i32::MIN;
44-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
58+
//~^ absurd_extreme_comparisons
59+
4560
let b = false;
4661
b >= true;
47-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
62+
//~^ absurd_extreme_comparisons
63+
4864
false > b;
49-
//~^ ERROR: this comparison involving the minimum or maximum element for this type con
65+
//~^ absurd_extreme_comparisons
66+
5067
u > 0; // ok
5168
// this is handled by clippy::unit_cmp
5269
() < {};
53-
//~^ ERROR: <-comparison of unit values detected. This will always be false
54-
//~| NOTE: `#[deny(clippy::unit_cmp)]` on by default
70+
//~^ unit_cmp
71+
72+
5573
}
5674

5775
use std::cmp::{Ordering, PartialEq, PartialOrd};

tests/ui/absurd-extreme-comparisons.stderr

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,135 +9,135 @@ LL | u <= 0;
99
= help: to override `-D warnings` add `#[allow(clippy::absurd_extreme_comparisons)]`
1010

1111
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
12-
--> tests/ui/absurd-extreme-comparisons.rs:16:5
12+
--> tests/ui/absurd-extreme-comparisons.rs:17:5
1313
|
1414
LL | u <= Z;
1515
| ^^^^^^
1616
|
1717
= help: because `Z` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == Z` instead
1818

1919
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
20-
--> tests/ui/absurd-extreme-comparisons.rs:18:5
20+
--> tests/ui/absurd-extreme-comparisons.rs:20:5
2121
|
2222
LL | u < Z;
2323
| ^^^^^
2424
|
2525
= help: because `Z` is the minimum value for this type, this comparison is always false
2626

2727
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
28-
--> tests/ui/absurd-extreme-comparisons.rs:20:5
28+
--> tests/ui/absurd-extreme-comparisons.rs:23:5
2929
|
3030
LL | Z >= u;
3131
| ^^^^^^
3232
|
3333
= help: because `Z` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `Z == u` instead
3434

3535
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
36-
--> tests/ui/absurd-extreme-comparisons.rs:22:5
36+
--> tests/ui/absurd-extreme-comparisons.rs:26:5
3737
|
3838
LL | Z > u;
3939
| ^^^^^
4040
|
4141
= help: because `Z` is the minimum value for this type, this comparison is always false
4242

4343
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
44-
--> tests/ui/absurd-extreme-comparisons.rs:24:5
44+
--> tests/ui/absurd-extreme-comparisons.rs:29:5
4545
|
4646
LL | u > u32::MAX;
4747
| ^^^^^^^^^^^^
4848
|
4949
= help: because `u32::MAX` is the maximum value for this type, this comparison is always false
5050

5151
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
52-
--> tests/ui/absurd-extreme-comparisons.rs:26:5
52+
--> tests/ui/absurd-extreme-comparisons.rs:32:5
5353
|
5454
LL | u >= u32::MAX;
5555
| ^^^^^^^^^^^^^
5656
|
5757
= help: because `u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u == u32::MAX` instead
5858

5959
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
60-
--> tests/ui/absurd-extreme-comparisons.rs:28:5
60+
--> tests/ui/absurd-extreme-comparisons.rs:35:5
6161
|
6262
LL | u32::MAX < u;
6363
| ^^^^^^^^^^^^
6464
|
6565
= help: because `u32::MAX` is the maximum value for this type, this comparison is always false
6666

6767
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
68-
--> tests/ui/absurd-extreme-comparisons.rs:30:5
68+
--> tests/ui/absurd-extreme-comparisons.rs:38:5
6969
|
7070
LL | u32::MAX <= u;
7171
| ^^^^^^^^^^^^^
7272
|
7373
= help: because `u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u32::MAX == u` instead
7474

7575
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
76-
--> tests/ui/absurd-extreme-comparisons.rs:32:5
76+
--> tests/ui/absurd-extreme-comparisons.rs:41:5
7777
|
7878
LL | 1-1 > u;
7979
| ^^^^^^^
8080
|
8181
= help: because `1-1` is the minimum value for this type, this comparison is always false
8282

8383
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
84-
--> tests/ui/absurd-extreme-comparisons.rs:34:5
84+
--> tests/ui/absurd-extreme-comparisons.rs:44:5
8585
|
8686
LL | u >= !0;
8787
| ^^^^^^^
8888
|
8989
= help: because `!0` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u == !0` instead
9090

9191
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
92-
--> tests/ui/absurd-extreme-comparisons.rs:36:5
92+
--> tests/ui/absurd-extreme-comparisons.rs:47:5
9393
|
9494
LL | u <= 12 - 2*6;
9595
| ^^^^^^^^^^^^^
9696
|
9797
= help: because `12 - 2*6` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == 12 - 2*6` instead
9898

9999
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
100-
--> tests/ui/absurd-extreme-comparisons.rs:39:5
100+
--> tests/ui/absurd-extreme-comparisons.rs:51:5
101101
|
102102
LL | i < -127 - 1;
103103
| ^^^^^^^^^^^^
104104
|
105105
= help: because `-127 - 1` is the minimum value for this type, this comparison is always false
106106

107107
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
108-
--> tests/ui/absurd-extreme-comparisons.rs:41:5
108+
--> tests/ui/absurd-extreme-comparisons.rs:54:5
109109
|
110110
LL | i8::MAX >= i;
111111
| ^^^^^^^^^^^^
112112
|
113113
= help: because `i8::MAX` is the maximum value for this type, this comparison is always true
114114

115115
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
116-
--> tests/ui/absurd-extreme-comparisons.rs:43:5
116+
--> tests/ui/absurd-extreme-comparisons.rs:57:5
117117
|
118118
LL | 3-7 < i32::MIN;
119119
| ^^^^^^^^^^^^^^
120120
|
121121
= help: because `i32::MIN` is the minimum value for this type, this comparison is always false
122122

123123
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
124-
--> tests/ui/absurd-extreme-comparisons.rs:46:5
124+
--> tests/ui/absurd-extreme-comparisons.rs:61:5
125125
|
126126
LL | b >= true;
127127
| ^^^^^^^^^
128128
|
129129
= help: because `true` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `b == true` instead
130130

131131
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
132-
--> tests/ui/absurd-extreme-comparisons.rs:48:5
132+
--> tests/ui/absurd-extreme-comparisons.rs:64:5
133133
|
134134
LL | false > b;
135135
| ^^^^^^^^^
136136
|
137137
= help: because `false` is the minimum value for this type, this comparison is always false
138138

139139
error: <-comparison of unit values detected. This will always be false
140-
--> tests/ui/absurd-extreme-comparisons.rs:52:5
140+
--> tests/ui/absurd-extreme-comparisons.rs:69:5
141141
|
142142
LL | () < {};
143143
| ^^^^^^^

tests/ui/allow_attributes.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use proc_macros::{external, with_span};
1111

1212
// Should lint
1313
#[expect(dead_code)]
14+
//~^ allow_attributes
1415
struct T1;
1516

1617
struct T2; // Should not lint
@@ -20,6 +21,7 @@ struct T3;
2021
struct T4;
2122
// `panic = "unwind"` should always be true
2223
#[cfg_attr(panic = "unwind", expect(dead_code))]
24+
//~^ allow_attributes
2325
struct CfgT;
2426

2527
#[allow(clippy::allow_attributes, unused)]
@@ -51,6 +53,7 @@ fn ignore_inner_attr() {
5153
#[clippy::msrv = "1.81"]
5254
fn msrv_1_81() {
5355
#[expect(unused)]
56+
//~^ allow_attributes
5457
let x = 1;
5558
}
5659

tests/ui/allow_attributes.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use proc_macros::{external, with_span};
1111

1212
// Should lint
1313
#[allow(dead_code)]
14+
//~^ allow_attributes
1415
struct T1;
1516

1617
struct T2; // Should not lint
@@ -20,6 +21,7 @@ struct T3;
2021
struct T4;
2122
// `panic = "unwind"` should always be true
2223
#[cfg_attr(panic = "unwind", allow(dead_code))]
24+
//~^ allow_attributes
2325
struct CfgT;
2426

2527
#[allow(clippy::allow_attributes, unused)]
@@ -51,6 +53,7 @@ fn ignore_inner_attr() {
5153
#[clippy::msrv = "1.81"]
5254
fn msrv_1_81() {
5355
#[allow(unused)]
56+
//~^ allow_attributes
5457
let x = 1;
5558
}
5659

tests/ui/allow_attributes.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ LL | #[allow(dead_code)]
88
= help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]`
99

1010
error: #[allow] attribute found
11-
--> tests/ui/allow_attributes.rs:22:30
11+
--> tests/ui/allow_attributes.rs:23:30
1212
|
1313
LL | #[cfg_attr(panic = "unwind", allow(dead_code))]
1414
| ^^^^^ help: replace it with: `expect`
1515

1616
error: #[allow] attribute found
17-
--> tests/ui/allow_attributes.rs:53:7
17+
--> tests/ui/allow_attributes.rs:55:7
1818
|
1919
LL | #[allow(unused)]
2020
| ^^^^^ help: replace it with: `expect`

tests/ui/allow_attributes_without_reason.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
//@aux-build:proc_macros.rs
22
#![deny(clippy::allow_attributes_without_reason)]
33
#![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
4+
//~^ allow_attributes_without_reason
45

56
extern crate proc_macros;
67
use proc_macros::{external, with_span};
78

89
// These should trigger the lint
910
#[allow(dead_code)]
11+
//~^ allow_attributes_without_reason
1012
#[allow(dead_code, deprecated)]
13+
//~^ allow_attributes_without_reason
1114
#[expect(dead_code)]
15+
//~^ allow_attributes_without_reason
1216
// These should be fine
1317
#[allow(dead_code, reason = "This should be allowed")]
1418
#[warn(dyn_drop, reason = "Warnings can also have reasons")]
@@ -44,6 +48,7 @@ pub fn trigger_fp_result() -> Result<(), &'static str> {
4448
#[clippy::msrv = "1.81"]
4549
fn msrv_1_81() {
4650
#[allow(unused)]
51+
//~^ allow_attributes_without_reason
4752
let _ = 1;
4853
}
4954

tests/ui/allow_attributes_without_reason.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ LL | #![deny(clippy::allow_attributes_without_reason)]
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1313

1414
error: `allow` attribute without specifying a reason
15-
--> tests/ui/allow_attributes_without_reason.rs:9:1
15+
--> tests/ui/allow_attributes_without_reason.rs:10:1
1616
|
1717
LL | #[allow(dead_code)]
1818
| ^^^^^^^^^^^^^^^^^^^
1919
|
2020
= help: try adding a reason at the end with `, reason = ".."`
2121

2222
error: `allow` attribute without specifying a reason
23-
--> tests/ui/allow_attributes_without_reason.rs:10:1
23+
--> tests/ui/allow_attributes_without_reason.rs:12:1
2424
|
2525
LL | #[allow(dead_code, deprecated)]
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2727
|
2828
= help: try adding a reason at the end with `, reason = ".."`
2929

3030
error: `expect` attribute without specifying a reason
31-
--> tests/ui/allow_attributes_without_reason.rs:11:1
31+
--> tests/ui/allow_attributes_without_reason.rs:14:1
3232
|
3333
LL | #[expect(dead_code)]
3434
| ^^^^^^^^^^^^^^^^^^^^
3535
|
3636
= help: try adding a reason at the end with `, reason = ".."`
3737

3838
error: `allow` attribute without specifying a reason
39-
--> tests/ui/allow_attributes_without_reason.rs:46:5
39+
--> tests/ui/allow_attributes_without_reason.rs:50:5
4040
|
4141
LL | #[allow(unused)]
4242
| ^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)