]> git.lizzy.rs Git - rust.git/blob - src/docs/clone_double_ref.txt
Add iter_kv_map lint
[rust.git] / src / docs / clone_double_ref.txt
1 ### What it does
2 Checks for usage of `.clone()` on an `&&T`.
3
4 ### Why is this bad?
5 Cloning an `&&T` copies the inner `&T`, instead of
6 cloning the underlying `T`.
7
8 ### Example
9 ```
10 fn main() {
11     let x = vec![1];
12     let y = &&x;
13     let z = y.clone();
14     println!("{:p} {:p}", *y, z); // prints out the same pointer
15 }
16 ```