about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorblake2-ppc <blake2-ppc>2013-06-28 13:52:37 +0200
committerDaniel Micay <danielmicay@gmail.com>2013-06-29 01:03:37 -0400
commitb9cf6a33d2b5c0006f780c01bcaae4047551eb75 (patch)
treec0b109725190d3b0f74dc01bbb1b349dc23c9441 /src/libstd
parentee7307e6cb9e942fc1ef27109bfbc6fbf730ee3c (diff)
downloadrust-b9cf6a33d2b5c0006f780c01bcaae4047551eb75.tar.gz
rust-b9cf6a33d2b5c0006f780c01bcaae4047551eb75.zip
iterator: UnfoldrIterator::new should have function argument last
To match Rust conventions and enable use of `do` etc, make sure the
closure is the last argument to the `new` method.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/iterator.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs
index 78940143f4e..765bf3b36f2 100644
--- a/src/libstd/iterator.rs
+++ b/src/libstd/iterator.rs
@@ -983,7 +983,7 @@ impl<'self, A, St> UnfoldrIterator<'self, A, St> {
     /// Creates a new iterator with the specified closure as the "iterator
     /// function" and an initial state to eventually pass to the iterator
     #[inline]
-    pub fn new<'a>(f: &'a fn(&mut St) -> Option<A>, initial_state: St)
+    pub fn new<'a>(initial_state: St, f: &'a fn(&mut St) -> Option<A>)
         -> UnfoldrIterator<'a, A, St> {
         UnfoldrIterator {
             f: f,
@@ -1174,7 +1174,7 @@ mod tests {
             }
         }
 
-        let mut it = UnfoldrIterator::new(count, 0);
+        let mut it = UnfoldrIterator::new(0, count);
         let mut i = 0;
         for it.advance |counted| {
             assert_eq!(counted, i);