Use matches macro in libcore and libstd

This commit is contained in:
Igor Aleksanov 2020-01-07 10:35:16 +03:00
parent aa0769b92e
commit f720469fd0
12 changed files with 29 additions and 118 deletions

View file

@ -2968,10 +2968,7 @@ pub trait Iterator {
Self::Item: PartialOrd<I::Item>,
Self: Sized,
{
match self.partial_cmp(other) {
Some(Ordering::Less) | Some(Ordering::Equal) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Ordering::Less) | Some(Ordering::Equal))
}
/// Determines if the elements of this `Iterator` are lexicographically
@ -3011,10 +3008,7 @@ pub trait Iterator {
Self::Item: PartialOrd<I::Item>,
Self: Sized,
{
match self.partial_cmp(other) {
Some(Ordering::Greater) | Some(Ordering::Equal) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Ordering::Greater) | Some(Ordering::Equal))
}
/// Checks if the elements of this iterator are sorted.