Skip to content

Commit 075b269

Browse files
committed
Simplify Iterator::{lt, gt}
1 parent 6778396 commit 075b269

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/libcore/iter/traits/iterator.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -2451,10 +2451,7 @@ pub trait Iterator {
24512451
Self::Item: PartialOrd<I::Item>,
24522452
Self: Sized,
24532453
{
2454-
match self.partial_cmp(other) {
2455-
Some(Ordering::Less) => true,
2456-
_ => false,
2457-
}
2454+
self.partial_cmp(other) == Some(Ordering::Less)
24582455
}
24592456

24602457
/// Determines if the elements of this `Iterator` are lexicographically
@@ -2479,10 +2476,7 @@ pub trait Iterator {
24792476
Self::Item: PartialOrd<I::Item>,
24802477
Self: Sized,
24812478
{
2482-
match self.partial_cmp(other) {
2483-
Some(Ordering::Greater) => true,
2484-
_ => false,
2485-
}
2479+
self.partial_cmp(other) == Some(Ordering::Greater)
24862480
}
24872481

24882482
/// Determines if the elements of this `Iterator` are lexicographically

0 commit comments

Comments
 (0)