mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Move ref cow tests
This commit moves the ref cow tests from needless_borrow.rs to ptr_arg.rs where all the other PTR_ARG tests are.
This commit is contained in:
parent
62d595b3dc
commit
2fd671e4bd
4 changed files with 18 additions and 21 deletions
|
@ -51,12 +51,3 @@ fn issue_1432() {
|
|||
|
||||
let _ = v.iter().filter(|&a| a.is_empty());
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn test_cow_with_ref(c: &Cow<[i32]>) {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn test_cow(c: Cow<[i32]>) {
|
||||
let _c = c;
|
||||
}
|
||||
|
|
|
@ -38,13 +38,5 @@ error: this pattern creates a reference to a reference
|
|||
50 | let _ = v.iter().filter(|&ref a| a.is_empty());
|
||||
| ^^^^^ help: change this to: `a`
|
||||
|
||||
error: using a reference to `Cow` is not recommended.
|
||||
--> $DIR/needless_borrow.rs:56:25
|
||||
|
|
||||
56 | fn test_cow_with_ref(c: &Cow<[i32]>) {
|
||||
| ^^^^^^^^^^^ help: change this to: `&[i32]`
|
||||
|
|
||||
= note: `-D ptr-arg` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
|
||||
#![allow(unused, many_single_char_names)]
|
||||
#![warn(ptr_arg)]
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
fn do_vec(x: &Vec<i64>) {
|
||||
//Nothing here
|
||||
}
|
||||
|
@ -67,3 +67,11 @@ fn false_positive_capacity_too(x: &String) -> String {
|
|||
x.clone()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn test_cow_with_ref(c: &Cow<[i32]>) {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn test_cow(c: Cow<[i32]>) {
|
||||
let _c = c;
|
||||
}
|
||||
|
|
|
@ -76,5 +76,11 @@ help: change `y.as_str()` to
|
|||
62 | let c = y;
|
||||
| ^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: using a reference to `Cow` is not recommended.
|
||||
--> $DIR/ptr_arg.rs:71:25
|
||||
|
|
||||
71 | fn test_cow_with_ref(c: &Cow<[i32]>) {
|
||||
| ^^^^^^^^^^^ help: change this to: `&[i32]`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue