summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/clone_double_ref.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/clone_double_ref.txt')
-rw-r--r--src/tools/clippy/src/docs/clone_double_ref.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/clone_double_ref.txt b/src/tools/clippy/src/docs/clone_double_ref.txt
new file mode 100644
index 000000000..2729635bd
--- /dev/null
+++ b/src/tools/clippy/src/docs/clone_double_ref.txt
@@ -0,0 +1,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
+}
+``` \ No newline at end of file