Skip to content

Commit e19db29

Browse files
committed
Attributes cleanup in tests [16/20]
1 parent fdd9f4e commit e19db29

80 files changed

Lines changed: 477 additions & 550 deletions

File tree

Some content is hidden

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

tests/ui/ref_as_ptr.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::ref_as_ptr)]
2-
#![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)]
2+
#![allow(clippy::unnecessary_mut_passed)]
33

44
fn f<T>(_: T) {}
55

tests/ui/ref_as_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::ref_as_ptr)]
2-
#![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)]
2+
#![allow(clippy::unnecessary_mut_passed)]
33

44
fn f<T>(_: T) {}
55

tests/ui/ref_binding_to_reference.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// FIXME: run-rustfix waiting on multi-span suggestions
22
//@no-rustfix
33
#![warn(clippy::ref_binding_to_reference)]
4-
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]
4+
#![expect(clippy::explicit_auto_deref, clippy::needless_borrowed_reference)]
55

66
fn f1(_: &str) {}
77
macro_rules! m2 {
@@ -15,7 +15,6 @@ macro_rules! m3 {
1515
};
1616
}
1717

18-
#[allow(dead_code)]
1918
fn main() {
2019
let x = String::new();
2120

tests/ui/ref_binding_to_reference.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this pattern creates a reference to a reference
2-
--> tests/ui/ref_binding_to_reference.rs:30:14
2+
--> tests/ui/ref_binding_to_reference.rs:29:14
33
|
44
LL | Some(ref x) => x,
55
| ^^^^^
@@ -13,7 +13,7 @@ LL + Some(x) => &x,
1313
|
1414

1515
error: this pattern creates a reference to a reference
16-
--> tests/ui/ref_binding_to_reference.rs:37:14
16+
--> tests/ui/ref_binding_to_reference.rs:36:14
1717
|
1818
LL | Some(ref x) => {
1919
| ^^^^^
@@ -29,7 +29,7 @@ LL ~ &x
2929
|
3030

3131
error: this pattern creates a reference to a reference
32-
--> tests/ui/ref_binding_to_reference.rs:49:14
32+
--> tests/ui/ref_binding_to_reference.rs:48:14
3333
|
3434
LL | Some(ref x) => m2!(x),
3535
| ^^^^^
@@ -41,7 +41,7 @@ LL + Some(x) => m2!(&x),
4141
|
4242

4343
error: this pattern creates a reference to a reference
44-
--> tests/ui/ref_binding_to_reference.rs:55:15
44+
--> tests/ui/ref_binding_to_reference.rs:54:15
4545
|
4646
LL | let _ = |&ref x: &&String| {
4747
| ^^^^^
@@ -55,7 +55,7 @@ LL ~ let _: &&String = &x;
5555
|
5656

5757
error: this pattern creates a reference to a reference
58-
--> tests/ui/ref_binding_to_reference.rs:63:12
58+
--> tests/ui/ref_binding_to_reference.rs:62:12
5959
|
6060
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
6161
| ^^^^^
@@ -70,7 +70,7 @@ LL ~ x
7070
|
7171

7272
error: this pattern creates a reference to a reference
73-
--> tests/ui/ref_binding_to_reference.rs:72:11
73+
--> tests/ui/ref_binding_to_reference.rs:71:11
7474
|
7575
LL | fn f(&ref x: &&String) {
7676
| ^^^^^
@@ -84,7 +84,7 @@ LL ~ let _: &&String = &x;
8484
|
8585

8686
error: this pattern creates a reference to a reference
87-
--> tests/ui/ref_binding_to_reference.rs:82:11
87+
--> tests/ui/ref_binding_to_reference.rs:81:11
8888
|
8989
LL | fn f(&ref x: &&String) {
9090
| ^^^^^

tests/ui/ref_option_ref.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(unused)]
21
#![warn(clippy::ref_option_ref)]
32
//@no-rustfix
43
// This lint is not tagged as run-rustfix because automatically

tests/ui/ref_option_ref.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
2-
--> tests/ui/ref_option_ref.rs:10:23
2+
--> tests/ui/ref_option_ref.rs:9:23
33
|
44
LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD);
55
| ^^^^^^^^^^^^^ help: try: `Option<&i32>`
@@ -8,61 +8,61 @@ LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD);
88
= help: to override `-D warnings` add `#[allow(clippy::ref_option_ref)]`
99

1010
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
11-
--> tests/ui/ref_option_ref.rs:14:18
11+
--> tests/ui/ref_option_ref.rs:13:18
1212
|
1313
LL | const REF_CONST: &Option<&i32> = &Some(CONST_THRESHOLD);
1414
| ^^^^^^^^^^^^^ help: try: `Option<&i32>`
1515

1616
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
17-
--> tests/ui/ref_option_ref.rs:17:25
17+
--> tests/ui/ref_option_ref.rs:16:25
1818
|
1919
LL | type RefOptRefU32<'a> = &'a Option<&'a u32>;
2020
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`
2121

2222
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
23-
--> tests/ui/ref_option_ref.rs:20:25
23+
--> tests/ui/ref_option_ref.rs:19:25
2424
|
2525
LL | type RefOptRef<'a, T> = &'a Option<&'a T>;
2626
| ^^^^^^^^^^^^^^^^^ help: try: `Option<&'a T>`
2727

2828
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
29-
--> tests/ui/ref_option_ref.rs:23:14
29+
--> tests/ui/ref_option_ref.rs:22:14
3030
|
3131
LL | fn foo(data: &Option<&u32>) {}
3232
| ^^^^^^^^^^^^^ help: try: `Option<&u32>`
3333

3434
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
35-
--> tests/ui/ref_option_ref.rs:26:23
35+
--> tests/ui/ref_option_ref.rs:25:23
3636
|
3737
LL | fn bar(data: &u32) -> &Option<&u32> {
3838
| ^^^^^^^^^^^^^ help: try: `Option<&u32>`
3939

4040
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
41-
--> tests/ui/ref_option_ref.rs:33:11
41+
--> tests/ui/ref_option_ref.rs:32:11
4242
|
4343
LL | data: &'a Option<&'a u32>,
4444
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`
4545

4646
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
47-
--> tests/ui/ref_option_ref.rs:37:32
47+
--> tests/ui/ref_option_ref.rs:36:32
4848
|
4949
LL | struct StructTupleRef<'a>(u32, &'a Option<&'a u32>);
5050
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`
5151

5252
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
53-
--> tests/ui/ref_option_ref.rs:42:14
53+
--> tests/ui/ref_option_ref.rs:41:14
5454
|
5555
LL | Variant2(&'a Option<&'a u32>),
5656
| ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>`
5757

5858
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
59-
--> tests/ui/ref_option_ref.rs:52:14
59+
--> tests/ui/ref_option_ref.rs:51:14
6060
|
6161
LL | type A = &'static Option<&'static Self>;
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'static Self>`
6363

6464
error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
65-
--> tests/ui/ref_option_ref.rs:59:12
65+
--> tests/ui/ref_option_ref.rs:58:12
6666
|
6767
LL | let x: &Option<&u32> = &None;
6868
| ^^^^^^^^^^^^^ help: try: `Option<&u32>`

tests/ui/ref_patterns.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(unused)]
21
#![warn(clippy::ref_patterns)]
32

43
fn use_in_pattern() {

tests/ui/ref_patterns.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: usage of ref pattern
2-
--> tests/ui/ref_patterns.rs:8:14
2+
--> tests/ui/ref_patterns.rs:7:14
33
|
44
LL | Some(ref opt) => {},
55
| ^^^^^^^
@@ -9,15 +9,15 @@ LL | Some(ref opt) => {},
99
= help: to override `-D warnings` add `#[allow(clippy::ref_patterns)]`
1010

1111
error: usage of ref pattern
12-
--> tests/ui/ref_patterns.rs:15:9
12+
--> tests/ui/ref_patterns.rs:14:9
1313
|
1414
LL | let ref y = x;
1515
| ^^^^^
1616
|
1717
= help: consider using `&` for clarity instead
1818

1919
error: usage of ref pattern
20-
--> tests/ui/ref_patterns.rs:19:21
20+
--> tests/ui/ref_patterns.rs:18:21
2121
|
2222
LL | fn use_in_parameter(ref x: i32) {}
2323
| ^^^^^

tests/ui/regex.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
//@require-annotations-for-level: WARN
2-
#![allow(
3-
unused,
4-
clippy::needless_raw_strings,
5-
clippy::needless_raw_string_hashes,
6-
clippy::needless_borrow,
7-
clippy::needless_borrows_for_generic_args
8-
)]
9-
#![warn(clippy::invalid_regex, clippy::trivial_regex, clippy::regex_creation_in_loops)]
2+
#![warn(clippy::invalid_regex, clippy::regex_creation_in_loops, clippy::trivial_regex)]
3+
#![expect(clippy::needless_borrows_for_generic_args)]
104

115
extern crate regex;
126

0 commit comments

Comments
 (0)