mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #101816 - raldone01:cleanup/select_nth_unstable, r=Mark-Simulacrum
Cleanup slice sort related closures in core and alloc
This commit is contained in:
commit
4c2e500788
@ -205,7 +205,7 @@ impl<T> [T] {
|
|||||||
where
|
where
|
||||||
T: Ord,
|
T: Ord,
|
||||||
{
|
{
|
||||||
merge_sort(self, |a, b| a.lt(b));
|
merge_sort(self, T::lt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sorts the slice with a comparator function.
|
/// Sorts the slice with a comparator function.
|
||||||
|
@ -2540,7 +2540,7 @@ impl<T> [T] {
|
|||||||
where
|
where
|
||||||
T: Ord,
|
T: Ord,
|
||||||
{
|
{
|
||||||
sort::quicksort(self, |a, b| a.lt(b));
|
sort::quicksort(self, T::lt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sorts the slice with a comparator function, but might not preserve the order of equal
|
/// Sorts the slice with a comparator function, but might not preserve the order of equal
|
||||||
@ -2679,8 +2679,7 @@ impl<T> [T] {
|
|||||||
where
|
where
|
||||||
T: Ord,
|
T: Ord,
|
||||||
{
|
{
|
||||||
let mut f = |a: &T, b: &T| a.lt(b);
|
sort::partition_at_index(self, index, T::lt)
|
||||||
sort::partition_at_index(self, index, &mut f)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reorder the slice with a comparator function such that the element at `index` is at its
|
/// Reorder the slice with a comparator function such that the element at `index` is at its
|
||||||
@ -2731,8 +2730,7 @@ impl<T> [T] {
|
|||||||
where
|
where
|
||||||
F: FnMut(&T, &T) -> Ordering,
|
F: FnMut(&T, &T) -> Ordering,
|
||||||
{
|
{
|
||||||
let mut f = |a: &T, b: &T| compare(a, b) == Less;
|
sort::partition_at_index(self, index, |a: &T, b: &T| compare(a, b) == Less)
|
||||||
sort::partition_at_index(self, index, &mut f)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reorder the slice with a key extraction function such that the element at `index` is at its
|
/// Reorder the slice with a key extraction function such that the element at `index` is at its
|
||||||
@ -2784,8 +2782,7 @@ impl<T> [T] {
|
|||||||
F: FnMut(&T) -> K,
|
F: FnMut(&T) -> K,
|
||||||
K: Ord,
|
K: Ord,
|
||||||
{
|
{
|
||||||
let mut g = |a: &T, b: &T| f(a).lt(&f(b));
|
sort::partition_at_index(self, index, |a: &T, b: &T| f(a).lt(&f(b)))
|
||||||
sort::partition_at_index(self, index, &mut g)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Moves all consecutive repeated elements to the end of the slice according to the
|
/// Moves all consecutive repeated elements to the end of the slice according to the
|
||||||
|
Loading…
Reference in New Issue
Block a user