about summary refs log tree commit diff
path: root/src/docs/clone_double_ref.txt
blob: 2729635bd246f0710c1c2b8cbd9a4f4a35165023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Checks for usage of `.clone()` on an `&&T`.

### Why is this bad?
Cloning an `&&T` copies the inner `&T`, instead of
cloning the underlying `T`.

### Example
```
fn main() {
    let x = vec![1];
    let y = &&x;
    let z = y.clone();
    println!("{:p} {:p}", *y, z); // prints out the same pointer
}
```