@@ -123,7 +123,7 @@ fn test_cow_with_ref(c: &Cow<[i32]>) {}
123
123
//~^ ptr_arg
124
124
125
125
fn test_cow ( c : Cow < [ i32 ] > ) {
126
- let _c = c;
126
+ let d = c;
127
127
}
128
128
129
129
trait Foo2 {
@@ -141,36 +141,36 @@ mod issue_5644 {
141
141
use std:: path:: PathBuf ;
142
142
143
143
fn allowed (
144
- #[ allow( clippy:: ptr_arg) ] _v : & Vec < u32 > ,
145
- #[ allow( clippy:: ptr_arg) ] _s : & String ,
146
- #[ allow( clippy:: ptr_arg) ] _p : & PathBuf ,
147
- #[ allow( clippy:: ptr_arg) ] _c : & Cow < [ i32 ] > ,
148
- #[ expect( clippy:: ptr_arg) ] _expect : & Cow < [ i32 ] > ,
144
+ #[ allow( clippy:: ptr_arg) ] v : & Vec < u32 > ,
145
+ #[ allow( clippy:: ptr_arg) ] s : & String ,
146
+ #[ allow( clippy:: ptr_arg) ] p : & PathBuf ,
147
+ #[ allow( clippy:: ptr_arg) ] c : & Cow < [ i32 ] > ,
148
+ #[ expect( clippy:: ptr_arg) ] expect : & Cow < [ i32 ] > ,
149
149
) {
150
150
}
151
151
152
- fn some_allowed ( #[ allow( clippy:: ptr_arg) ] _v : & Vec < u32 > , _s : & String ) { }
152
+ fn some_allowed ( #[ allow( clippy:: ptr_arg) ] v : & Vec < u32 > , s : & String ) { }
153
153
//~^ ptr_arg
154
154
155
155
struct S ;
156
156
impl S {
157
157
fn allowed (
158
- #[ allow( clippy:: ptr_arg) ] _v : & Vec < u32 > ,
159
- #[ allow( clippy:: ptr_arg) ] _s : & String ,
160
- #[ allow( clippy:: ptr_arg) ] _p : & PathBuf ,
161
- #[ allow( clippy:: ptr_arg) ] _c : & Cow < [ i32 ] > ,
162
- #[ expect( clippy:: ptr_arg) ] _expect : & Cow < [ i32 ] > ,
158
+ #[ allow( clippy:: ptr_arg) ] v : & Vec < u32 > ,
159
+ #[ allow( clippy:: ptr_arg) ] s : & String ,
160
+ #[ allow( clippy:: ptr_arg) ] p : & PathBuf ,
161
+ #[ allow( clippy:: ptr_arg) ] c : & Cow < [ i32 ] > ,
162
+ #[ expect( clippy:: ptr_arg) ] expect : & Cow < [ i32 ] > ,
163
163
) {
164
164
}
165
165
}
166
166
167
167
trait T {
168
168
fn allowed (
169
- #[ allow( clippy:: ptr_arg) ] _v : & Vec < u32 > ,
170
- #[ allow( clippy:: ptr_arg) ] _s : & String ,
171
- #[ allow( clippy:: ptr_arg) ] _p : & PathBuf ,
172
- #[ allow( clippy:: ptr_arg) ] _c : & Cow < [ i32 ] > ,
173
- #[ expect( clippy:: ptr_arg) ] _expect : & Cow < [ i32 ] > ,
169
+ #[ allow( clippy:: ptr_arg) ] v : & Vec < u32 > ,
170
+ #[ allow( clippy:: ptr_arg) ] s : & String ,
171
+ #[ allow( clippy:: ptr_arg) ] p : & PathBuf ,
172
+ #[ allow( clippy:: ptr_arg) ] c : & Cow < [ i32 ] > ,
173
+ #[ expect( clippy:: ptr_arg) ] expect : & Cow < [ i32 ] > ,
174
174
) {
175
175
}
176
176
}
@@ -182,22 +182,22 @@ mod issue6509 {
182
182
fn foo_vec ( vec : & Vec < u8 > ) {
183
183
//~^ ptr_arg
184
184
185
- let _ = vec. clone ( ) . pop ( ) ;
186
- let _ = vec. clone ( ) . clone ( ) ;
185
+ let a = vec. clone ( ) . pop ( ) ;
186
+ let b = vec. clone ( ) . clone ( ) ;
187
187
}
188
188
189
189
fn foo_path ( path : & PathBuf ) {
190
190
//~^ ptr_arg
191
191
192
- let _ = path. clone ( ) . pop ( ) ;
193
- let _ = path. clone ( ) . clone ( ) ;
192
+ let c = path. clone ( ) . pop ( ) ;
193
+ let d = path. clone ( ) . clone ( ) ;
194
194
}
195
195
196
196
fn foo_str ( str : & PathBuf ) {
197
197
//~^ ptr_arg
198
198
199
- let _ = str. clone ( ) . pop ( ) ;
200
- let _ = str. clone ( ) . clone ( ) ;
199
+ let e = str. clone ( ) . pop ( ) ;
200
+ let f = str. clone ( ) . clone ( ) ;
201
201
}
202
202
}
203
203
@@ -340,8 +340,8 @@ mod issue_13308 {
340
340
ToOwned :: clone_into ( source, destination) ;
341
341
}
342
342
343
- fn h1 ( _ : & <String as Deref >:: Target ) { }
344
- fn h2 < T : Deref > ( _ : T , _ : & T :: Target ) { }
343
+ fn h1 ( x : & <String as Deref >:: Target ) { }
344
+ fn h2 < T : Deref > ( x : T , y : & T :: Target ) { }
345
345
346
346
// Other cases that are still ok to lint and ideally shouldn't regress
347
347
fn good ( v1 : & String , v2 : & String ) {
@@ -353,28 +353,28 @@ mod issue_13308 {
353
353
}
354
354
}
355
355
356
- mod issue_13489 {
356
+ mod issue_13489_and_13728 {
357
357
// This is a no-lint from now on.
358
- fn foo ( _x : & mut Vec < i32 > ) {
358
+ fn foo ( _x : & Vec < i32 > ) {
359
359
todo ! ( ) ;
360
360
}
361
361
362
362
// But this still gives us a lint.
363
- fn foo_used ( x : & mut Vec < i32 > ) {
363
+ fn foo_used ( x : & Vec < i32 > ) {
364
364
//~^ ptr_arg
365
365
366
366
todo ! ( ) ;
367
367
}
368
368
369
369
// This is also a no-lint from now on.
370
- fn foo_local ( x : & mut Vec < i32 > ) {
370
+ fn foo_local ( x : & Vec < i32 > ) {
371
371
let _y = x;
372
372
373
373
todo ! ( ) ;
374
374
}
375
375
376
376
// But this still gives us a lint.
377
- fn foo_local_used ( x : & mut Vec < i32 > ) {
377
+ fn foo_local_used ( x : & Vec < i32 > ) {
378
378
//~^ ptr_arg
379
379
380
380
let y = x;
@@ -383,21 +383,21 @@ mod issue_13489 {
383
383
}
384
384
385
385
// This only lints once from now on.
386
- fn foofoo ( _x : & mut Vec < i32 > , y : & mut String ) {
386
+ fn foofoo ( _x : & Vec < i32 > , y : & String ) {
387
387
//~^ ptr_arg
388
388
389
389
todo ! ( ) ;
390
390
}
391
391
392
392
// And this is also a no-lint from now on.
393
- fn foofoo_local ( _x : & mut Vec < i32 > , y : & mut String ) {
393
+ fn foofoo_local ( _x : & Vec < i32 > , y : & String ) {
394
394
let _z = y;
395
395
396
396
todo ! ( ) ;
397
397
}
398
398
}
399
399
400
- mod issue_13728 {
400
+ mod issue_13489_and_13728_mut {
401
401
// This is a no-lint from now on.
402
402
fn bar ( _x : & mut Vec < u32 > ) {
403
403
todo ! ( )
0 commit comments