remove HRTB from [T]::is_sorted_by{,_key}
This commit is contained in:
@@ -3724,9 +3724,9 @@ impl<T> [T] {
|
|||||||
/// [`is_sorted`]: slice::is_sorted
|
/// [`is_sorted`]: slice::is_sorted
|
||||||
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
|
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_sorted_by<F>(&self, mut compare: F) -> bool
|
pub fn is_sorted_by<'a, F>(&'a self, mut compare: F) -> bool
|
||||||
where
|
where
|
||||||
F: FnMut(&T, &T) -> Option<Ordering>,
|
F: FnMut(&'a T, &'a T) -> Option<Ordering>,
|
||||||
{
|
{
|
||||||
self.iter().is_sorted_by(|a, b| compare(*a, *b))
|
self.iter().is_sorted_by(|a, b| compare(*a, *b))
|
||||||
}
|
}
|
||||||
@@ -3750,9 +3750,9 @@ impl<T> [T] {
|
|||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
|
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_sorted_by_key<F, K>(&self, f: F) -> bool
|
pub fn is_sorted_by_key<'a, F, K>(&'a self, f: F) -> bool
|
||||||
where
|
where
|
||||||
F: FnMut(&T) -> K,
|
F: FnMut(&'a T) -> K,
|
||||||
K: PartialOrd,
|
K: PartialOrd,
|
||||||
{
|
{
|
||||||
self.iter().is_sorted_by_key(f)
|
self.iter().is_sorted_by_key(f)
|
||||||
|
|||||||
Reference in New Issue
Block a user