mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 17:18:32 +03:00
16 lines
322 B
Plaintext
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
|
|
}
|
|
``` |