diff --git a/tests/compile-fail/methods.rs b/tests/compile-fail/methods.rs index 464a7c26e44..4e515c2aa12 100644 --- a/tests/compile-fail/methods.rs +++ b/tests/compile-fail/methods.rs @@ -1,8 +1,8 @@ #![feature(plugin)] #![plugin(clippy)] -#![allow(unused)] #![deny(clippy, clippy_pedantic)] +#![allow(unused, print_stdout)] use std::collections::BTreeMap; use std::collections::HashMap; @@ -334,3 +334,13 @@ fn clone_on_copy_generic(t: T) { t.clone(); //~ERROR using `clone` on a `Copy` type Some(t).clone(); //~ERROR using `clone` on a `Copy` type } + +fn clone_on_double_ref() { + let x = vec![1]; + let y = &&x; + let z: &Vec<_> = y.clone(); //~ERROR using `clone` on a double + //~| HELP try dereferencing it + //~| SUGGESTION let z: &Vec<_> = (*y).clone(); + //~^^^ERROR using `clone` on a `Copy` type + println!("{:p} {:p}",*y, z); +}