Skip to content

Commit 3bccfe3

Browse files
committed
Add error annotations for all tests
1 parent 345fc07 commit 3bccfe3

File tree

1,173 files changed

+12939
-7997
lines changed

Some content is hidden

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

1,173 files changed

+12939
-7997
lines changed

tests/ui-toml/absolute_paths/absolute_paths.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ pub mod a {
3737

3838
fn main() {
3939
f32::max(1.0, 2.0);
40-
std::f32::MAX;
41-
core::f32::MAX;
42-
::core::f32::MAX;
43-
crate::a::b::c::C;
44-
crate::a::b::c::d::e::f::F;
45-
crate::a::A;
46-
crate::a::b::B;
47-
crate::a::b::c::C::ZERO;
48-
helper::b::c::d::e::f();
49-
::helper::b::c::d::e::f();
40+
std::f32::MAX; //~ absolute_paths
41+
core::f32::MAX; //~ absolute_paths
42+
::core::f32::MAX; //~ absolute_paths
43+
crate::a::b::c::C; //~[disallow_crates] absolute_paths
44+
crate::a::b::c::d::e::f::F; //~[disallow_crates] absolute_paths
45+
crate::a::A; //~[disallow_crates] absolute_paths
46+
crate::a::b::B; //~[disallow_crates] absolute_paths
47+
crate::a::b::c::C::ZERO; //~[disallow_crates] absolute_paths
48+
helper::b::c::d::e::f(); //~[disallow_crates] absolute_paths
49+
::helper::b::c::d::e::f(); //~[disallow_crates] absolute_paths
5050
fn b() -> a::b::B {
5151
todo!()
5252
}
@@ -55,7 +55,7 @@ fn main() {
5555
std::ptr::addr_of!(x);
5656
// Test we handle max segments with `PathRoot` properly; this has 4 segments but we should say it
5757
// has 3
58-
::std::f32::MAX;
58+
::std::f32::MAX; //~ absolute_paths
5959
// Do not lint due to the above
6060
::helper::a();
6161
// Do not lint

tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.fixed

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ fn main() {
66
let local_f64 = 2.0;
77
let local_opt: Option<i32> = Some(3);
88

9-
println!("val='{local_i32}'");
9+
println!("val='{local_i32}'"); //~ uninlined_format_args
1010
println!("Hello x is {local_f64:.local_i32$}");
11+
//~^ uninlined_format_args
12+
//~| print_literal
1113
println!("Hello {local_i32} is {local_f64:.*}", 5);
14+
//~^ uninlined_format_args
1215
println!("Hello {local_i32} is {local_f64:.*}", 5);
16+
//~^ uninlined_format_args
1317
println!("{local_i32}, {}", local_opt.unwrap());
18+
//~^ uninlined_format_args
1419
}

tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ fn main() {
66
let local_f64 = 2.0;
77
let local_opt: Option<i32> = Some(3);
88

9-
println!("val='{}'", local_i32);
9+
println!("val='{}'", local_i32); //~ uninlined_format_args
1010
println!("Hello {} is {:.*}", "x", local_i32, local_f64);
11+
//~^ uninlined_format_args
12+
//~| print_literal
1113
println!("Hello {} is {:.*}", local_i32, 5, local_f64);
14+
//~^ uninlined_format_args
1215
println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
16+
//~^ uninlined_format_args
1317
println!("{}, {}", local_i32, local_opt.unwrap());
18+
//~^ uninlined_format_args
1419
}

tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ LL + println!("Hello x is {:.*}", local_i32, local_f64);
3939
|
4040

4141
error: variables can be used directly in the `format!` string
42-
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:11:5
42+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:13:5
4343
|
4444
LL | println!("Hello {} is {:.*}", local_i32, 5, local_f64);
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -51,7 +51,7 @@ LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
5151
|
5252

5353
error: variables can be used directly in the `format!` string
54-
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:12:5
54+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:15:5
5555
|
5656
LL | println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -63,7 +63,7 @@ LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
6363
|
6464

6565
error: variables can be used directly in the `format!` string
66-
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:13:5
66+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:17:5
6767
|
6868
LL | println!("{}, {}", local_i32, local_opt.unwrap());
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn lhs_and_rhs_are_equal() {
6666
// is implicitly on the list
6767
let _ = Bar + Bar;
6868
// not on the list
69-
let _ = Baz + Baz;
69+
let _ = Baz + Baz; //~ arithmetic_side_effects
7070
}
7171

7272
fn lhs_is_different() {
@@ -77,14 +77,14 @@ fn lhs_is_different() {
7777
// is implicitly on the list
7878
let _ = 1i32 + Bar;
7979
// not on the list
80-
let _ = 1i32 + Baz;
80+
let _ = 1i32 + Baz; //~ arithmetic_side_effects
8181

8282
// not on the list
83-
let _ = 1i64 + Foo;
83+
let _ = 1i64 + Foo; //~ arithmetic_side_effects
8484
// is implicitly on the list
8585
let _ = 1i64 + Bar;
8686
// not on the list
87-
let _ = 1i64 + Baz;
87+
let _ = 1i64 + Baz; //~ arithmetic_side_effects
8888
}
8989

9090
fn rhs_is_different() {
@@ -95,14 +95,14 @@ fn rhs_is_different() {
9595
// is implicitly on the list
9696
let _ = Bar + 1i32;
9797
// not on the list
98-
let _ = Baz + 1i32;
98+
let _ = Baz + 1i32; //~ arithmetic_side_effects
9999

100100
// not on the list
101-
let _ = Foo + 1i64;
101+
let _ = Foo + 1i64; //~ arithmetic_side_effects
102102
// is implicitly on the list
103103
let _ = Bar + 1i64;
104104
// not on the list
105-
let _ = Baz + 1i64;
105+
let _ = Baz + 1i64; //~ arithmetic_side_effects
106106
}
107107

108108
fn unary() {
@@ -111,9 +111,9 @@ fn unary() {
111111
// is explicitly on the list
112112
let _ = -Foo;
113113
// not on the list
114-
let _ = -Bar;
114+
let _ = -Bar; //~ arithmetic_side_effects
115115
// not on the list
116-
let _ = -Baz;
116+
let _ = -Baz; //~ arithmetic_side_effects
117117
}
118118

119119
fn main() {}

tests/ui-toml/array_size_threshold/array_size_threshold.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
#![warn(clippy::large_const_arrays, clippy::large_stack_arrays)]
33
//@no-rustfix
44
const ABOVE: [u8; 11] = [0; 11];
5+
//~^ large_const_arrays
6+
//~| large_stack_arrays
57
const BELOW: [u8; 10] = [0; 10];
68

79
fn main() {
8-
let above = [0u8; 11];
10+
let above = [0u8; 11]; //~ large_stack_arrays
911
let below = [0u8; 10];
1012
}

tests/ui-toml/array_size_threshold/array_size_threshold.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
2020
= help: to override `-D warnings` add `#[allow(clippy::large_stack_arrays)]`
2121

2222
error: allocating a local array larger than 10 bytes
23-
--> $DIR/array_size_threshold/array_size_threshold.rs:8:17
23+
--> $DIR/array_size_threshold/array_size_threshold.rs:10:17
2424
|
2525
LL | let above = [0u8; 11];
2626
| ^^^^^^^^^

tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
use std::net::Ipv4Addr;
33

44
async fn bad() -> u32 {
5-
let _x = String::from("hello");
5+
let _x = String::from("hello"); //~ await_holding_invalid_type
66
baz().await
77
}
88

99
async fn bad_reason() -> u32 {
1010
let x = Ipv4Addr::new(127, 0, 0, 1);
11+
//~^ await_holding_invalid_type
1112
let y = baz().await;
1213
let _x = x;
1314
y
@@ -30,7 +31,7 @@ async fn baz() -> u32 {
3031
#[allow(clippy::manual_async_fn)]
3132
fn block_bad() -> impl std::future::Future<Output = u32> {
3233
async move {
33-
let _x = String::from("hi!");
34+
let _x = String::from("hi!"); //~ await_holding_invalid_type
3435
baz().await
3536
}
3637
}

tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LL | let x = Ipv4Addr::new(127, 0, 0, 1);
1515
| ^
1616

1717
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
18-
--> $DIR/await_holding_invalid_type/await_holding_invalid_type.rs:33:13
18+
--> $DIR/await_holding_invalid_type/await_holding_invalid_type.rs:34:13
1919
|
2020
LL | let _x = String::from("hi!");
2121
| ^^

tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
fn main() {}
44

55
#[warn(clippy::cognitive_complexity)]
6+
//~v cognitive_complexity
67
fn cognitive_complexity() {
78
let x = vec![1, 2, 3];
89
for i in x {

tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | blacklisted-names = [ "..", "wibble" ]
1111
| ^^^^^^^^^^^^^^^^^
1212

1313
error: the function has a cognitive complexity of (3/2)
14-
--> $DIR/conf_deprecated_key/conf_deprecated_key.rs:6:4
14+
--> $DIR/conf_deprecated_key/conf_deprecated_key.rs:7:4
1515
|
1616
LL | fn cognitive_complexity() {
1717
| ^^^^^^^^^^^^^^^^^^^^

tests/ui-toml/dbg_macro/dbg_macro.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33
//@no-rustfix
44
fn foo(n: u32) -> u32 {
55
if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
6+
//~^ dbg_macro
67
}
78

89
fn factorial(n: u32) -> u32 {
10+
11+
//~v dbg_macro
912
if dbg!(n <= 1) {
10-
dbg!(1)
13+
dbg!(1) //~ dbg_macro
1114
} else {
12-
dbg!(n * factorial(n - 1))
15+
dbg!(n * factorial(n - 1)) //~ dbg_macro
1316
}
1417
}
1518

1619
fn main() {
17-
dbg!(42);
18-
dbg!(dbg!(dbg!(42)));
19-
foo(3) + dbg!(factorial(4));
20-
dbg!(1, 2, dbg!(3, 4));
21-
dbg!(1, 2, 3, 4, 5);
20+
dbg!(42); //~ dbg_macro
21+
dbg!(dbg!(dbg!(42))); //~ dbg_macro
22+
foo(3) + dbg!(factorial(4)); //~ dbg_macro
23+
dbg!(1, 2, dbg!(3, 4)); //~ dbg_macro
24+
dbg!(1, 2, 3, 4, 5); //~ dbg_macro
2225
}
2326

2427
#[test]

tests/ui-toml/dbg_macro/dbg_macro.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | if let Some(n) = n.checked_sub(4) { n } else { n }
1212
| ~~~~~~~~~~~~~~~~
1313

1414
error: the `dbg!` macro is intended as a debugging tool
15-
--> $DIR/dbg_macro/dbg_macro.rs:9:8
15+
--> $DIR/dbg_macro/dbg_macro.rs:12:8
1616
|
1717
LL | if dbg!(n <= 1) {
1818
| ^^^^^^^^^^^^
@@ -23,29 +23,29 @@ LL | if n <= 1 {
2323
| ~~~~~~
2424

2525
error: the `dbg!` macro is intended as a debugging tool
26-
--> $DIR/dbg_macro/dbg_macro.rs:10:9
26+
--> $DIR/dbg_macro/dbg_macro.rs:13:9
2727
|
2828
LL | dbg!(1)
2929
| ^^^^^^^
3030
|
3131
help: remove the invocation before committing it to a version control system
3232
|
3333
LL | 1
34-
|
34+
| ~
3535

3636
error: the `dbg!` macro is intended as a debugging tool
37-
--> $DIR/dbg_macro/dbg_macro.rs:12:9
37+
--> $DIR/dbg_macro/dbg_macro.rs:15:9
3838
|
3939
LL | dbg!(n * factorial(n - 1))
4040
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
4141
|
4242
help: remove the invocation before committing it to a version control system
4343
|
4444
LL | n * factorial(n - 1)
45-
|
45+
| ~~~~~~~~~~~~~~~~~~~~
4646

4747
error: the `dbg!` macro is intended as a debugging tool
48-
--> $DIR/dbg_macro/dbg_macro.rs:17:5
48+
--> $DIR/dbg_macro/dbg_macro.rs:20:5
4949
|
5050
LL | dbg!(42);
5151
| ^^^^^^^^
@@ -56,7 +56,7 @@ LL | 42;
5656
| ~~
5757

5858
error: the `dbg!` macro is intended as a debugging tool
59-
--> $DIR/dbg_macro/dbg_macro.rs:18:5
59+
--> $DIR/dbg_macro/dbg_macro.rs:21:5
6060
|
6161
LL | dbg!(dbg!(dbg!(42)));
6262
| ^^^^^^^^^^^^^^^^^^^^
@@ -67,7 +67,7 @@ LL | dbg!(dbg!(42));
6767
| ~~~~~~~~~~~~~~
6868

6969
error: the `dbg!` macro is intended as a debugging tool
70-
--> $DIR/dbg_macro/dbg_macro.rs:19:14
70+
--> $DIR/dbg_macro/dbg_macro.rs:22:14
7171
|
7272
LL | foo(3) + dbg!(factorial(4));
7373
| ^^^^^^^^^^^^^^^^^^
@@ -78,7 +78,7 @@ LL | foo(3) + factorial(4);
7878
| ~~~~~~~~~~~~
7979

8080
error: the `dbg!` macro is intended as a debugging tool
81-
--> $DIR/dbg_macro/dbg_macro.rs:20:5
81+
--> $DIR/dbg_macro/dbg_macro.rs:23:5
8282
|
8383
LL | dbg!(1, 2, dbg!(3, 4));
8484
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -89,7 +89,7 @@ LL | (1, 2, dbg!(3, 4));
8989
| ~~~~~~~~~~~~~~~~~~
9090

9191
error: the `dbg!` macro is intended as a debugging tool
92-
--> $DIR/dbg_macro/dbg_macro.rs:21:5
92+
--> $DIR/dbg_macro/dbg_macro.rs:24:5
9393
|
9494
LL | dbg!(1, 2, 3, 4, 5);
9595
| ^^^^^^^^^^^^^^^^^^^

tests/ui-toml/disallowed_macros/disallowed_macros.rs

+16-15
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,40 @@ use proc_macros::Derive;
1010
use serde::Serialize;
1111

1212
fn main() {
13-
println!("one");
14-
println!("two");
15-
cfg!(unix);
16-
vec![1, 2, 3];
13+
println!("one"); //~ disallowed_macros
14+
println!("two"); //~ disallowed_macros
15+
cfg!(unix); //~ disallowed_macros
16+
vec![1, 2, 3]; //~ disallowed_macros
1717

18-
#[derive(Serialize)]
18+
#[derive(Serialize)] //~ disallowed_macros
1919
struct Derive;
2020

21-
let _ = macros::expr!();
22-
macros::stmt!();
23-
let macros::pat!() = 1;
24-
let _: macros::ty!() = "";
25-
macros::item!();
26-
let _ = macros::binop!(1);
21+
let _ = macros::expr!(); //~ disallowed_macros
22+
macros::stmt!(); //~ disallowed_macros
23+
let macros::pat!() = 1; //~ disallowed_macros
24+
let _: macros::ty!() = ""; //~ disallowed_macros
25+
macros::item!(); //~ disallowed_macros
26+
let _ = macros::binop!(1); //~ disallowed_macros
2727

2828
eprintln!("allowed");
2929
}
3030

31+
//~v disallowed_macros
3132
macros::attr! {
3233
struct S;
3334
}
3435

3536
impl S {
36-
macros::item!();
37+
macros::item!(); //~ disallowed_macros
3738
}
3839

3940
trait Y {
40-
macros::item!();
41+
macros::item!(); //~ disallowed_macros
4142
}
4243

4344
impl Y for S {
44-
macros::item!();
45+
macros::item!(); //~ disallowed_macros
4546
}
4647

47-
#[derive(Derive)]
48+
#[derive(Derive)] //~ disallowed_macros
4849
struct Foo;

0 commit comments

Comments
 (0)