about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-11-23 21:51:12 +0100
committerGitHub <noreply@github.com>2017-11-23 21:51:12 +0100
commitf7373b1e1eb1c65f3f09e2d2045fcf0f865f76cc (patch)
treef3ed4cb838cf6f9faff9f3f507a529b6afe5fc51 /src/liballoc
parent808079aa2e135266e85ccf59720d92ab0733b3a9 (diff)
parente1b479cff94005b38717abd74598478cd7180766 (diff)
downloadrust-f7373b1e1eb1c65f3f09e2d2045fcf0f865f76cc.tar.gz
rust-f7373b1e1eb1c65f3f09e2d2045fcf0f865f76cc.zip
Rollup merge of #46218 - rust-lang:frewsxcv-rename-slice-swap-param, r=kennytm
Rename param in `[T]::swap_with_slice` from `src` to `other`.

The idea of ‘source’ and ‘destination’ aren’t very applicable for this
operation since both slices can both be considered sources and
destinations.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/slice.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index b41cb912fe7..7e3d2af79ce 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -1468,9 +1468,9 @@ impl<T> [T] {
         core_slice::SliceExt::copy_from_slice(self, src)
     }
 
-    /// Swaps all elements in `self` with those in `src`.
+    /// Swaps all elements in `self` with those in `other`.
     ///
-    /// The length of `src` must be the same as `self`.
+    /// The length of `other` must be the same as `self`.
     ///
     /// # Panics
     ///
@@ -1481,16 +1481,16 @@ impl<T> [T] {
     /// ```
     /// #![feature(swap_with_slice)]
     ///
-    /// let mut src = [1, 2, 3];
-    /// let mut dst = [7, 8, 9];
+    /// let mut slice1 = [1, 2, 3];
+    /// let mut slice2 = [7, 8, 9];
     ///
-    /// src.swap_with_slice(&mut dst);
-    /// assert_eq!(src, [7, 8, 9]);
-    /// assert_eq!(dst, [1, 2, 3]);
+    /// slice1.swap_with_slice(&mut slice2);
+    /// assert_eq!(slice1, [7, 8, 9]);
+    /// assert_eq!(slice2, [1, 2, 3]);
     /// ```
     #[unstable(feature = "swap_with_slice", issue = "44030")]
-    pub fn swap_with_slice(&mut self, src: &mut [T]) {
-        core_slice::SliceExt::swap_with_slice(self, src)
+    pub fn swap_with_slice(&mut self, other: &mut [T]) {
+        core_slice::SliceExt::swap_with_slice(self, other)
     }
 
     /// Copies `self` into a new `Vec`.