Skip to content

Commit 7ac4515

Browse files
committed
Clarify ambiguity in select_nth_unstable docs
1 parent 67b6975 commit 7ac4515

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

library/core/src/slice/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,7 @@ impl<T> [T] {
30473047
sort::quicksort(self, |a, b| f(a).lt(&f(b)));
30483048
}
30493049

3050-
/// Reorder the slice such that the element at `index` is at its final sorted position.
3050+
/// Reorder the slice such that the element at `index` after the reordering is at its final sorted position.
30513051
///
30523052
/// This reordering has the additional property that any value at position `i < index` will be
30533053
/// less than or equal to any value at a position `j > index`. Additionally, this reordering is
@@ -3075,7 +3075,7 @@ impl<T> [T] {
30753075
/// # Examples
30763076
///
30773077
/// ```
3078-
/// let mut v = [-5i32, 4, 1, -3, 2];
3078+
/// let mut v = [-5i32, 4, 2, -3, 1];
30793079
///
30803080
/// // Find the median
30813081
/// v.select_nth_unstable(2);
@@ -3096,8 +3096,8 @@ impl<T> [T] {
30963096
select::partition_at_index(self, index, T::lt)
30973097
}
30983098

3099-
/// Reorder the slice with a comparator function such that the element at `index` is at its
3100-
/// final sorted position.
3099+
/// Reorder the slice with a comparator function such that the element at `index` after the reordering is at
3100+
/// its final sorted position.
31013101
///
31023102
/// This reordering has the additional property that any value at position `i < index` will be
31033103
/// less than or equal to any value at a position `j > index` using the comparator function.
@@ -3126,7 +3126,7 @@ impl<T> [T] {
31263126
/// # Examples
31273127
///
31283128
/// ```
3129-
/// let mut v = [-5i32, 4, 1, -3, 2];
3129+
/// let mut v = [-5i32, 4, 2, -3, 1];
31303130
///
31313131
/// // Find the median as if the slice were sorted in descending order.
31323132
/// v.select_nth_unstable_by(2, |a, b| b.cmp(a));
@@ -3151,8 +3151,8 @@ impl<T> [T] {
31513151
select::partition_at_index(self, index, |a: &T, b: &T| compare(a, b) == Less)
31523152
}
31533153

3154-
/// Reorder the slice with a key extraction function such that the element at `index` is at its
3155-
/// final sorted position.
3154+
/// Reorder the slice with a key extraction function such that the element at `index` after the reordering is
3155+
/// at its final sorted position.
31563156
///
31573157
/// This reordering has the additional property that any value at position `i < index` will be
31583158
/// less than or equal to any value at a position `j > index` using the key extraction function.

0 commit comments

Comments
 (0)