Skip to content

Commit e1b479c

Browse files
committed
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.
1 parent b55d290 commit e1b479c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/liballoc/slice.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1468,9 +1468,9 @@ impl<T> [T] {
14681468
core_slice::SliceExt::copy_from_slice(self, src)
14691469
}
14701470

1471-
/// Swaps all elements in `self` with those in `src`.
1471+
/// Swaps all elements in `self` with those in `other`.
14721472
///
1473-
/// The length of `src` must be the same as `self`.
1473+
/// The length of `other` must be the same as `self`.
14741474
///
14751475
/// # Panics
14761476
///
@@ -1481,16 +1481,16 @@ impl<T> [T] {
14811481
/// ```
14821482
/// #![feature(swap_with_slice)]
14831483
///
1484-
/// let mut src = [1, 2, 3];
1485-
/// let mut dst = [7, 8, 9];
1484+
/// let mut slice1 = [1, 2, 3];
1485+
/// let mut slice2 = [7, 8, 9];
14861486
///
1487-
/// src.swap_with_slice(&mut dst);
1488-
/// assert_eq!(src, [7, 8, 9]);
1489-
/// assert_eq!(dst, [1, 2, 3]);
1487+
/// slice1.swap_with_slice(&mut slice2);
1488+
/// assert_eq!(slice1, [7, 8, 9]);
1489+
/// assert_eq!(slice2, [1, 2, 3]);
14901490
/// ```
14911491
#[unstable(feature = "swap_with_slice", issue = "44030")]
1492-
pub fn swap_with_slice(&mut self, src: &mut [T]) {
1493-
core_slice::SliceExt::swap_with_slice(self, src)
1492+
pub fn swap_with_slice(&mut self, other: &mut [T]) {
1493+
core_slice::SliceExt::swap_with_slice(self, other)
14941494
}
14951495

14961496
/// Copies `self` into a new `Vec`.

0 commit comments

Comments
 (0)