Skip to content

Commit 680ebf7

Browse files
committed
Add min and max specialisations for RangeInclusive
1 parent 8d1a302 commit 680ebf7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/iter/range.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
367367
self.end.replace_zero();
368368
None
369369
}
370+
371+
#[inline]
372+
fn min(self) -> Option<A> {
373+
Some(self.start)
374+
}
375+
376+
#[inline]
377+
fn max(self) -> Option<A> {
378+
Some(self.end)
379+
}
370380
}
371381

372382
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]

0 commit comments

Comments
 (0)