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:
Michael Wright 2018-04-05 17:59:35 +02:00
parent 62d595b3dc
commit 2fd671e4bd
4 changed files with 18 additions and 21 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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;
}

View file

@ -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