summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/swap_ptr_to_ref.txt
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/clippy/src/docs/swap_ptr_to_ref.txt23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/tools/clippy/src/docs/swap_ptr_to_ref.txt b/src/tools/clippy/src/docs/swap_ptr_to_ref.txt
deleted file mode 100644
index 0215d1e8a..000000000
--- a/src/tools/clippy/src/docs/swap_ptr_to_ref.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-### What it does
-Checks for calls to `core::mem::swap` where either parameter is derived from a pointer
-
-### Why is this bad?
-When at least one parameter to `swap` is derived from a pointer it may overlap with the
-other. This would then lead to undefined behavior.
-
-### Example
-```
-unsafe fn swap(x: &[*mut u32], y: &[*mut u32]) {
- for (&x, &y) in x.iter().zip(y) {
- core::mem::swap(&mut *x, &mut *y);
- }
-}
-```
-Use instead:
-```
-unsafe fn swap(x: &[*mut u32], y: &[*mut u32]) {
- for (&x, &y) in x.iter().zip(y) {
- core::ptr::swap(x, y);
- }
-}
-``` \ No newline at end of file