diff options
Diffstat (limited to 'src/docs/clone_on_ref_ptr.txt')
| -rw-r--r-- | src/docs/clone_on_ref_ptr.txt | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/docs/clone_on_ref_ptr.txt b/src/docs/clone_on_ref_ptr.txt deleted file mode 100644 index 2d83f8fefc1..00000000000 --- a/src/docs/clone_on_ref_ptr.txt +++ /dev/null @@ -1,21 +0,0 @@ -### What it does -Checks for usage of `.clone()` on a ref-counted pointer, -(`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified -function syntax instead (e.g., `Rc::clone(foo)`). - -### Why is this bad? -Calling '.clone()' on an Rc, Arc, or Weak -can obscure the fact that only the pointer is being cloned, not the underlying -data. - -### Example -``` -let x = Rc::new(1); - -x.clone(); -``` - -Use instead: -``` -Rc::clone(&x); -``` \ No newline at end of file |
