diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index c3ed1b7a9ad7..8a28988c2cbc 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -346,8 +346,9 @@ pub trait IteratorExt: Iterator {
/// ```
#[inline]
#[unstable = "waiting for unboxed closures"]
- fn scan<'r, St, B>(self, initial_state: St, f: |&mut St, A|: 'r -> Option)
- -> Scan<'r, A, B, Self, St> {
+ fn scan(self, initial_state: St, f: F) -> Scan where
+ F: FnMut(&mut St, A) -> Option,
+ {
Scan{iter: self, f: f, state: initial_state}
}
@@ -1833,16 +1834,19 @@ impl> RandomAccessIterator for Take {
/// An iterator to maintain state while iterating another iterator
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[unstable = "waiting for unboxed closures"]
-pub struct Scan<'a, A, B, T, St> {
- iter: T,
- f: |&mut St, A|: 'a -> Option,
+pub struct Scan where I: Iterator, F: FnMut(&mut St, A) -> Option {
+ iter: I,
+ f: F,
/// The current internal state to be passed to the closure next.
pub state: St,
}
#[unstable = "trait is unstable"]
-impl<'a, A, B, T: Iterator, St> Iterator for Scan<'a, A, B, T, St> {
+impl Iterator for Scan where
+ I: Iterator,
+ F: FnMut(&mut St, A) -> Option,
+{
#[inline]
fn next(&mut self) -> Option {
self.iter.next().and_then(|a| (self.f)(&mut self.state, a))