Reduce genericity in Iterator::last
This commit is contained in:
parent
0e300e4380
commit
7539fc69d5
@ -267,7 +267,12 @@ fn add1<T>(count: usize, _: T) -> usize {
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn last(self) -> Option<Self::Item> where Self: Sized {
|
||||
self.fold(None, |_, x| Some(x))
|
||||
#[inline]
|
||||
fn some<T>(_: Option<T>, x: T) -> Option<T> {
|
||||
Some(x)
|
||||
}
|
||||
|
||||
self.fold(None, some)
|
||||
}
|
||||
|
||||
/// Returns the `n`th element of the iterator.
|
||||
|
Loading…
Reference in New Issue
Block a user