Skip to content

Commit 30c61ee

Browse files
committed
std: edit [T]::swap docs
Add a note telling that no elements change when arguments are equal
1 parent 27e10c5 commit 30c61ee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/slice/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,8 @@ impl<T> [T] {
851851

852852
/// Swaps two elements in the slice.
853853
///
854+
/// If `a` equals to `b`, it's guaranteed that elements won't change value.
855+
///
854856
/// # Arguments
855857
///
856858
/// * a - The index of the first element

0 commit comments

Comments
 (0)