Files
rust/src/docs/clone_double_ref.txt
T

16 lines
322 B
Plaintext

### 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
}
```