From 680ebf7b16ff402e3c636a037448324517aca37a Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 4 Jan 2018 00:17:36 +0000 Subject: [PATCH] Add min and max specialisations for RangeInclusive --- src/libcore/iter/range.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index e9aee4a4676d..19a76302f178 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -367,6 +367,16 @@ impl Iterator for ops::RangeInclusive { self.end.replace_zero(); None } + + #[inline] + fn min(self) -> Option { + Some(self.start) + } + + #[inline] + fn max(self) -> Option { + Some(self.end) + } } #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]