Skip to content

Commit 3d9c36f

Browse files
committed
Add min specialisation for RangeFrom and last for RangeInclusive
1 parent 680ebf7 commit 3d9c36f

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
@@ -305,6 +305,11 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
305305
self.start = plus_n.add_one();
306306
Some(plus_n)
307307
}
308+
309+
#[inline]
310+
fn min(self) -> Option<A> {
311+
Some(self.start)
312+
}
308313
}
309314

310315
#[unstable(feature = "fused", issue = "35602")]
@@ -368,6 +373,11 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
368373
None
369374
}
370375

376+
#[inline]
377+
fn last(self) -> Option<A> {
378+
Some(self.end)
379+
}
380+
371381
#[inline]
372382
fn min(self) -> Option<A> {
373383
Some(self.start)

0 commit comments

Comments
 (0)