about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorGraham Fawcett <fawcett@uwindsor.ca>2012-01-18 15:18:26 -0500
committerBrian Anderson <banderson@mozilla.com>2012-01-21 13:31:12 -0800
commit35d12be2ce6f62ce75b4f59c2932415dc8b7b786 (patch)
tree408b7bd64a8cdfd53a36a88f1867b93514b6928b /src/libcore
parent818b646950e69410c6328a1fe914e7a4edf6de72 (diff)
fix #1352: change param order on vec::init_fn (and vec::init_fn_mut), putting block in final position.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/vec.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 1868c79e97b..918b99d1b8a 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -88,7 +88,7 @@ Creates and initializes an immutable vector.
 Creates an immutable vector of size `n_elts` and initializes the elements
 to the value returned by the function `op`.
 */
-fn init_fn<T>(op: init_op<T>, n_elts: uint) -> [T] {
+fn init_fn<T>(n_elts: uint, op: init_op<T>) -> [T] {
     let v = [];
     reserve(v, n_elts);
     let i: uint = 0u;
@@ -105,7 +105,7 @@ Creates and initializes a mutable vector.
 Creates a mutable vector of size `n_elts` and initializes the elements to
 the value returned by the function `op`.
 */
-fn init_fn_mut<T>(op: init_op<T>, n_elts: uint) -> [mutable T] {
+fn init_fn_mut<T>(n_elts: uint, op: init_op<T>) -> [mutable T] {
     let v = [mutable];
     reserve(v, n_elts);
     let i: uint = 0u;
@@ -365,13 +365,13 @@ Function: grow_fn
 Expands a vector in place, initializing the new elements to the result of a
 function
 
-Function `init_fn` is called `n` times with the values [0..`n`)
+Function `init_op` is called `n` times with the values [0..`n`)
 
 Parameters:
 
 v - The vector to grow
 n - The number of elements to add
-init_fn - A function to call to retreive each appended element's value
+init_op - A function to call to retreive each appended element's value
 */
 fn grow_fn<T>(&v: [T], n: uint, op: init_op<T>) {
     reserve(v, next_power_of_two(len(v) + n));
@@ -1026,14 +1026,14 @@ mod tests {
     #[test]
     fn test_init_fn() {
         // Test on-stack init_fn.
-        let v = init_fn(square, 3u);
+        let v = init_fn(3u, square);
         assert (len(v) == 3u);
         assert (v[0] == 0u);
         assert (v[1] == 1u);
         assert (v[2] == 4u);
 
         // Test on-heap init_fn.
-        v = init_fn(square, 5u);
+        v = init_fn(5u, square);
         assert (len(v) == 5u);
         assert (v[0] == 0u);
         assert (v[1] == 1u);