Skip to content

Commit 9bd159a

Browse files
committed
Attributes cleanup in tests [13/20]
1 parent fdd9f4e commit 9bd159a

99 files changed

Lines changed: 553 additions & 698 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/needless_borrow.fixed

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
#![allow(
2-
unused,
3-
non_local_definitions,
4-
clippy::uninlined_format_args,
5-
clippy::unnecessary_mut_passed,
6-
clippy::unnecessary_to_owned,
1+
#![warn(clippy::needless_borrow)]
2+
#![expect(
3+
clippy::needless_lifetimes,
74
clippy::unnecessary_literal_unwrap,
8-
clippy::needless_lifetimes
5+
clippy::unnecessary_mut_passed
96
)]
10-
#![warn(clippy::needless_borrow)]
117

128
fn main() {
139
let a = 5;

tests/ui/needless_borrow.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
#![allow(
2-
unused,
3-
non_local_definitions,
4-
clippy::uninlined_format_args,
5-
clippy::unnecessary_mut_passed,
6-
clippy::unnecessary_to_owned,
1+
#![warn(clippy::needless_borrow)]
2+
#![expect(
3+
clippy::needless_lifetimes,
74
clippy::unnecessary_literal_unwrap,
8-
clippy::needless_lifetimes
5+
clippy::unnecessary_mut_passed
96
)]
10-
#![warn(clippy::needless_borrow)]
117

128
fn main() {
139
let a = 5;

tests/ui/needless_borrow.stderr

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this expression creates a reference which is immediately dereferenced by the compiler
2-
--> tests/ui/needless_borrow.rs:16:15
2+
--> tests/ui/needless_borrow.rs:12:15
33
|
44
LL | let _ = x(&&a); // warn
55
| ^^^ help: change this to: `&a`
@@ -8,163 +8,163 @@ LL | let _ = x(&&a); // warn
88
= help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`
99

1010
error: this expression creates a reference which is immediately dereferenced by the compiler
11-
--> tests/ui/needless_borrow.rs:22:13
11+
--> tests/ui/needless_borrow.rs:18:13
1212
|
1313
LL | mut_ref(&mut &mut b); // warn
1414
| ^^^^^^^^^^^ help: change this to: `&mut b`
1515

1616
error: this expression creates a reference which is immediately dereferenced by the compiler
17-
--> tests/ui/needless_borrow.rs:36:13
17+
--> tests/ui/needless_borrow.rs:32:13
1818
|
1919
LL | &&a
2020
| ^^^ help: change this to: `&a`
2121

2222
error: this expression creates a reference which is immediately dereferenced by the compiler
23-
--> tests/ui/needless_borrow.rs:39:15
23+
--> tests/ui/needless_borrow.rs:35:15
2424
|
2525
LL | 46 => &&a,
2626
| ^^^ help: change this to: `&a`
2727

2828
error: this expression creates a reference which is immediately dereferenced by the compiler
29-
--> tests/ui/needless_borrow.rs:46:27
29+
--> tests/ui/needless_borrow.rs:42:27
3030
|
3131
LL | break &ref_a;
3232
| ^^^^^^ help: change this to: `ref_a`
3333

3434
error: this expression creates a reference which is immediately dereferenced by the compiler
35-
--> tests/ui/needless_borrow.rs:54:15
35+
--> tests/ui/needless_borrow.rs:50:15
3636
|
3737
LL | let _ = x(&&&a);
3838
| ^^^^ help: change this to: `&a`
3939

4040
error: this expression creates a reference which is immediately dereferenced by the compiler
41-
--> tests/ui/needless_borrow.rs:56:15
41+
--> tests/ui/needless_borrow.rs:52:15
4242
|
4343
LL | let _ = x(&mut &&a);
4444
| ^^^^^^^^ help: change this to: `&a`
4545

4646
error: this expression creates a reference which is immediately dereferenced by the compiler
47-
--> tests/ui/needless_borrow.rs:58:15
47+
--> tests/ui/needless_borrow.rs:54:15
4848
|
4949
LL | let _ = x(&&&mut b);
5050
| ^^^^^^^^ help: change this to: `&mut b`
5151

5252
error: this expression creates a reference which is immediately dereferenced by the compiler
53-
--> tests/ui/needless_borrow.rs:60:15
53+
--> tests/ui/needless_borrow.rs:56:15
5454
|
5555
LL | let _ = x(&&ref_a);
5656
| ^^^^^^^ help: change this to: `ref_a`
5757

5858
error: this expression creates a reference which is immediately dereferenced by the compiler
59-
--> tests/ui/needless_borrow.rs:64:11
59+
--> tests/ui/needless_borrow.rs:60:11
6060
|
6161
LL | x(&b);
6262
| ^^ help: change this to: `b`
6363

6464
error: this expression creates a reference which is immediately dereferenced by the compiler
65-
--> tests/ui/needless_borrow.rs:72:13
65+
--> tests/ui/needless_borrow.rs:68:13
6666
|
6767
LL | mut_ref(&mut x);
6868
| ^^^^^^ help: change this to: `x`
6969

7070
error: this expression creates a reference which is immediately dereferenced by the compiler
71-
--> tests/ui/needless_borrow.rs:74:13
71+
--> tests/ui/needless_borrow.rs:70:13
7272
|
7373
LL | mut_ref(&mut &mut x);
7474
| ^^^^^^^^^^^ help: change this to: `x`
7575

7676
error: this expression creates a reference which is immediately dereferenced by the compiler
77-
--> tests/ui/needless_borrow.rs:76:23
77+
--> tests/ui/needless_borrow.rs:72:23
7878
|
7979
LL | let y: &mut i32 = &mut x;
8080
| ^^^^^^ help: change this to: `x`
8181

8282
error: this expression creates a reference which is immediately dereferenced by the compiler
83-
--> tests/ui/needless_borrow.rs:78:23
83+
--> tests/ui/needless_borrow.rs:74:23
8484
|
8585
LL | let y: &mut i32 = &mut &mut x;
8686
| ^^^^^^^^^^^ help: change this to: `x`
8787

8888
error: this expression creates a reference which is immediately dereferenced by the compiler
89-
--> tests/ui/needless_borrow.rs:88:14
89+
--> tests/ui/needless_borrow.rs:84:14
9090
|
9191
LL | 0 => &mut x,
9292
| ^^^^^^ help: change this to: `x`
9393

9494
error: this expression creates a reference which is immediately dereferenced by the compiler
95-
--> tests/ui/needless_borrow.rs:95:14
95+
--> tests/ui/needless_borrow.rs:91:14
9696
|
9797
LL | 0 => &mut x,
9898
| ^^^^^^ help: change this to: `x`
9999

100100
error: this expression borrows a value the compiler would automatically borrow
101-
--> tests/ui/needless_borrow.rs:108:13
101+
--> tests/ui/needless_borrow.rs:104:13
102102
|
103103
LL | let _ = (&x).0;
104104
| ^^^^ help: change this to: `x`
105105

106106
error: this expression creates a reference which is immediately dereferenced by the compiler
107-
--> tests/ui/needless_borrow.rs:119:5
107+
--> tests/ui/needless_borrow.rs:115:5
108108
|
109109
LL | (&&()).foo();
110110
| ^^^^^^ help: change this to: `(&())`
111111

112112
error: this expression creates a reference which is immediately dereferenced by the compiler
113-
--> tests/ui/needless_borrow.rs:129:5
113+
--> tests/ui/needless_borrow.rs:125:5
114114
|
115115
LL | (&&5).foo();
116116
| ^^^^^ help: change this to: `(&5)`
117117

118118
error: this expression creates a reference which is immediately dereferenced by the compiler
119-
--> tests/ui/needless_borrow.rs:156:23
119+
--> tests/ui/needless_borrow.rs:152:23
120120
|
121121
LL | let x: (&str,) = (&"",);
122122
| ^^^ help: change this to: `""`
123123

124124
error: this expression borrows a value the compiler would automatically borrow
125-
--> tests/ui/needless_borrow.rs:199:13
125+
--> tests/ui/needless_borrow.rs:195:13
126126
|
127127
LL | (&self.f)()
128128
| ^^^^^^^^^ help: change this to: `(self.f)`
129129

130130
error: this expression borrows a value the compiler would automatically borrow
131-
--> tests/ui/needless_borrow.rs:209:13
131+
--> tests/ui/needless_borrow.rs:205:13
132132
|
133133
LL | (&mut self.f)()
134134
| ^^^^^^^^^^^^^ help: change this to: `(self.f)`
135135

136136
error: this expression borrows a value the compiler would automatically borrow
137-
--> tests/ui/needless_borrow.rs:247:22
137+
--> tests/ui/needless_borrow.rs:243:22
138138
|
139139
LL | let _ = &mut (&mut { x.u }).x;
140140
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
141141

142142
error: this expression borrows a value the compiler would automatically borrow
143-
--> tests/ui/needless_borrow.rs:255:22
143+
--> tests/ui/needless_borrow.rs:251:22
144144
|
145145
LL | let _ = &mut (&mut { x.u }).x;
146146
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
147147

148148
error: this expression borrows a value the compiler would automatically borrow
149-
--> tests/ui/needless_borrow.rs:260:22
149+
--> tests/ui/needless_borrow.rs:256:22
150150
|
151151
LL | let _ = &mut (&mut x.u).x;
152152
| ^^^^^^^^^^ help: change this to: `x.u`
153153

154154
error: this expression borrows a value the compiler would automatically borrow
155-
--> tests/ui/needless_borrow.rs:262:22
155+
--> tests/ui/needless_borrow.rs:258:22
156156
|
157157
LL | let _ = &mut (&mut { x.u }).x;
158158
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
159159

160160
error: this expression creates a reference which is immediately dereferenced by the compiler
161-
--> tests/ui/needless_borrow.rs:284:23
161+
--> tests/ui/needless_borrow.rs:280:23
162162
|
163163
LL | option.unwrap_or((&x.0,));
164164
| ^^^^ help: change this to: `x.0`
165165

166166
error: this expression creates a reference which is immediately dereferenced by the compiler
167-
--> tests/ui/needless_borrow.rs:291:13
167+
--> tests/ui/needless_borrow.rs:287:13
168168
|
169169
LL | let _ = (&slice).len();
170170
| ^^^^^^^^ help: change this to: `slice`

tests/ui/needless_borrow_pat.fixed

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![warn(clippy::needless_borrow)]
2-
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]
2+
#![allow(clippy::needless_borrowed_reference)]
3+
#![expect(clippy::explicit_auto_deref)]
34

45
fn f1(_: &str) {}
56
macro_rules! m1 {
@@ -30,7 +31,6 @@ macro_rules! if_chain {
3031
};
3132
}
3233

33-
#[allow(dead_code)]
3434
fn main() {
3535
let x = String::new();
3636

@@ -160,7 +160,6 @@ impl T1 for S {
160160
}
161161

162162
// Ok - used to error due to rustc bug
163-
#[allow(dead_code)]
164163
#[derive(Debug)]
165164
enum Foo<'a> {
166165
Str(&'a str),

tests/ui/needless_borrow_pat.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![warn(clippy::needless_borrow)]
2-
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]
2+
#![allow(clippy::needless_borrowed_reference)]
3+
#![expect(clippy::explicit_auto_deref)]
34

45
fn f1(_: &str) {}
56
macro_rules! m1 {
@@ -30,7 +31,6 @@ macro_rules! if_chain {
3031
};
3132
}
3233

33-
#[allow(dead_code)]
3434
fn main() {
3535
let x = String::new();
3636

@@ -160,7 +160,6 @@ impl T1 for S {
160160
}
161161

162162
// Ok - used to error due to rustc bug
163-
#[allow(dead_code)]
164163
#[derive(Debug)]
165164
enum Foo<'a> {
166165
Str(&'a str),

tests/ui/needless_borrowed_ref.fixed

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#![warn(clippy::needless_borrowed_reference)]
2-
#![allow(
3-
unused,
2+
#![expect(
43
irrefutable_let_patterns,
54
non_shorthand_field_patterns,
65
clippy::needless_borrow,
7-
clippy::needless_ifs,
86
clippy::unneeded_wildcard_pattern
97
)]
108

tests/ui/needless_borrowed_ref.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#![warn(clippy::needless_borrowed_reference)]
2-
#![allow(
3-
unused,
2+
#![expect(
43
irrefutable_let_patterns,
54
non_shorthand_field_patterns,
65
clippy::needless_borrow,
7-
clippy::needless_ifs,
86
clippy::unneeded_wildcard_pattern
97
)]
108

0 commit comments

Comments
 (0)