1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 #![allow(unused, clippy::many_single_char_names)]
11 #![warn(clippy::ptr_arg)]
15 fn do_vec(x: &Vec<i64>) {
19 fn do_vec_mut(x: &mut Vec<i64>) {
24 fn do_str(x: &String) {
28 fn do_str_mut(x: &mut String) {
37 fn do_vec(x: &Vec<i64>);
38 fn do_item(x: &Self::Item);
43 // no error, in trait impl (#425)
46 fn do_vec(x: &Vec<i64>) {}
47 fn do_item(x: &Vec<u8>) {}
50 fn cloned(x: &Vec<u8>) -> Vec<u8> {
52 let f = e.clone(); // OK
54 let h = g.clone(); // Alas, we cannot reliably detect this without following data.
59 fn str_cloned(x: &String) -> String {
63 let d = a.clone().clone().clone();
67 fn false_positive_capacity(x: &Vec<u8>, y: &String) {
73 fn false_positive_capacity_too(x: &String) -> String {
74 if x.capacity() > 1024 {
81 fn test_cow_with_ref(c: &Cow<[i32]>) {}
84 fn test_cow(c: Cow<[i32]>) {
92 // no error for &self references where self is of type String (#2293)
93 impl Foo2 for String {
94 fn do_string(&self) {}