2015-05-04 08:15:24 +02:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
2017-09-16 09:10:26 +02:00
|
|
|
#![allow(unused, many_single_char_names)]
|
2017-05-17 14:19:44 +02:00
|
|
|
#![warn(ptr_arg)]
|
2015-05-04 08:15:24 +02:00
|
|
|
|
2017-02-08 14:58:07 +01:00
|
|
|
fn do_vec(x: &Vec<i64>) {
|
2015-08-11 20:22:20 +02:00
|
|
|
//Nothing here
|
2015-05-04 08:15:24 +02:00
|
|
|
}
|
|
|
|
|
2015-08-21 18:28:17 +02:00
|
|
|
fn do_vec_mut(x: &mut Vec<i64>) { // no error here
|
|
|
|
//Nothing here
|
|
|
|
}
|
|
|
|
|
2017-02-08 14:58:07 +01:00
|
|
|
fn do_str(x: &String) {
|
2015-08-11 20:22:20 +02:00
|
|
|
//Nothing here either
|
2015-05-04 08:15:24 +02:00
|
|
|
}
|
|
|
|
|
2015-08-21 18:28:17 +02:00
|
|
|
fn do_str_mut(x: &mut String) { // no error here
|
|
|
|
//Nothing here either
|
|
|
|
}
|
|
|
|
|
2015-05-04 08:15:24 +02:00
|
|
|
fn main() {
|
|
|
|
}
|
2015-10-31 00:48:05 +01:00
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
type Item;
|
2017-02-08 14:58:07 +01:00
|
|
|
fn do_vec(x: &Vec<i64>);
|
2015-10-31 00:48:05 +01:00
|
|
|
fn do_item(x: &Self::Item);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Bar;
|
|
|
|
|
|
|
|
// no error, in trait impl (#425)
|
|
|
|
impl Foo for Bar {
|
|
|
|
type Item = Vec<u8>;
|
|
|
|
fn do_vec(x: &Vec<i64>) {}
|
2017-09-16 09:10:26 +02:00
|
|
|
fn do_item(x: &Vec<u8>) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn cloned(x: &Vec<u8>) -> Vec<u8> {
|
|
|
|
let e = x.clone();
|
|
|
|
let f = e.clone(); // OK
|
|
|
|
let g = x;
|
|
|
|
let h = g.clone(); // Alas, we cannot reliably detect this without following data.
|
|
|
|
let i = (e).clone();
|
|
|
|
x.clone()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn str_cloned(x: &String) -> String {
|
|
|
|
let a = x.clone();
|
|
|
|
let b = x.clone();
|
|
|
|
let c = b.clone();
|
|
|
|
let d = a.clone()
|
|
|
|
.clone()
|
|
|
|
.clone();
|
|
|
|
x.clone()
|
2015-10-31 00:48:05 +01:00
|
|
|
}
|