mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-14 21:16:50 +00:00
Test for double-ref lint
This commit is contained in:
parent
4eb9a921d4
commit
8f7b8524d3
@ -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: Copy>(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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user