@@ -123,7 +123,7 @@ fn test_cow_with_ref(c: &Cow<[i32]>) {}
123123//~^ ptr_arg
124124
125125fn test_cow ( c : Cow < [ i32 ] > ) {
126- let _c = c;
126+ let d = c;
127127}
128128
129129trait Foo2 {
@@ -141,36 +141,36 @@ mod issue_5644 {
141141 use std:: path:: PathBuf ;
142142
143143 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 ] > ,
149149 ) {
150150 }
151151
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 ) { }
153153 //~^ ptr_arg
154154
155155 struct S ;
156156 impl S {
157157 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 ] > ,
163163 ) {
164164 }
165165 }
166166
167167 trait T {
168168 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 ] > ,
174174 ) {
175175 }
176176 }
@@ -182,22 +182,22 @@ mod issue6509 {
182182 fn foo_vec ( vec : & Vec < u8 > ) {
183183 //~^ ptr_arg
184184
185- let _ = vec. clone ( ) . pop ( ) ;
186- let _ = vec. clone ( ) . clone ( ) ;
185+ let a = vec. clone ( ) . pop ( ) ;
186+ let b = vec. clone ( ) . clone ( ) ;
187187 }
188188
189189 fn foo_path ( path : & PathBuf ) {
190190 //~^ ptr_arg
191191
192- let _ = path. clone ( ) . pop ( ) ;
193- let _ = path. clone ( ) . clone ( ) ;
192+ let c = path. clone ( ) . pop ( ) ;
193+ let d = path. clone ( ) . clone ( ) ;
194194 }
195195
196- fn foo_str ( str : & PathBuf ) {
196+ fn foo_str ( str : & String ) {
197197 //~^ ptr_arg
198198
199- let _ = str. clone ( ) . pop ( ) ;
200- let _ = str. clone ( ) . clone ( ) ;
199+ let e = str. clone ( ) . pop ( ) ;
200+ let f = str. clone ( ) . clone ( ) ;
201201 }
202202}
203203
@@ -340,8 +340,8 @@ mod issue_13308 {
340340 ToOwned :: clone_into ( source, destination) ;
341341 }
342342
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 ) { }
345345
346346 // Other cases that are still ok to lint and ideally shouldn't regress
347347 fn good ( v1 : & String , v2 : & String ) {
@@ -352,3 +352,91 @@ mod issue_13308 {
352352 h2 ( String :: new ( ) , v2) ;
353353 }
354354}
355+
356+ mod issue_13489_and_13728 {
357+ // This is a no-lint from now on.
358+ fn foo ( _x : & Vec < i32 > ) {
359+ todo ! ( ) ;
360+ }
361+
362+ // But this still gives us a lint.
363+ fn foo_used ( x : & Vec < i32 > ) {
364+ //~^ ptr_arg
365+
366+ todo ! ( ) ;
367+ }
368+
369+ // This is also a no-lint from now on.
370+ fn foo_local ( x : & Vec < i32 > ) {
371+ let _y = x;
372+
373+ todo ! ( ) ;
374+ }
375+
376+ // But this still gives us a lint.
377+ fn foo_local_used ( x : & Vec < i32 > ) {
378+ //~^ ptr_arg
379+
380+ let y = x;
381+
382+ todo ! ( ) ;
383+ }
384+
385+ // This only lints once from now on.
386+ fn foofoo ( _x : & Vec < i32 > , y : & String ) {
387+ //~^ ptr_arg
388+
389+ todo ! ( ) ;
390+ }
391+
392+ // And this is also a no-lint from now on.
393+ fn foofoo_local ( _x : & Vec < i32 > , y : & String ) {
394+ let _z = y;
395+
396+ todo ! ( ) ;
397+ }
398+ }
399+
400+ mod issue_13489_and_13728_mut {
401+ // This is a no-lint from now on.
402+ fn bar ( _x : & mut Vec < u32 > ) {
403+ todo ! ( )
404+ }
405+
406+ // But this still gives us a lint.
407+ fn bar_used ( x : & mut Vec < u32 > ) {
408+ //~^ ptr_arg
409+
410+ todo ! ( )
411+ }
412+
413+ // This is also a no-lint from now on.
414+ fn bar_local ( x : & mut Vec < u32 > ) {
415+ let _y = x;
416+
417+ todo ! ( )
418+ }
419+
420+ // But this still gives us a lint.
421+ fn bar_local_used ( x : & mut Vec < u32 > ) {
422+ //~^ ptr_arg
423+
424+ let y = x;
425+
426+ todo ! ( )
427+ }
428+
429+ // This only lints once from now on.
430+ fn barbar ( _x : & mut Vec < u32 > , y : & mut String ) {
431+ //~^ ptr_arg
432+
433+ todo ! ( )
434+ }
435+
436+ // And this is also a no-lint from now on.
437+ fn barbar_local ( _x : & mut Vec < u32 > , y : & mut String ) {
438+ let _z = y;
439+
440+ todo ! ( )
441+ }
442+ }
0 commit comments