Add min and max specialisations for RangeInclusive

This commit is contained in:
varkor 2018-01-04 00:17:36 +00:00
parent 8d1a30289e
commit 680ebf7b16

View File

@ -367,6 +367,16 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
self.end.replace_zero();
None
}
#[inline]
fn min(self) -> Option<A> {
Some(self.start)
}
#[inline]
fn max(self) -> Option<A> {
Some(self.end)
}
}
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]