Skip to content

Commit f4ee558

Browse files
committed
core: Rename iter::to_list to to_vec. Closes #2056
1 parent ba3292d commit f4ee558

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/libcore/iter.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ fn foldr<A:copy,B,IA:iterable<A>>(
9999
ret b;
100100
}
101101

102-
fn to_list<A:copy,IA:iterable<A>>(self: IA) -> [A] {
102+
fn to_vec<A:copy,IA:iterable<A>>(self: IA) -> [A] {
103103
foldl::<A,[A],IA>(self, [], {|r, a| r + [a]})
104104
}
105105

106106
// FIXME: This could be made more efficient with an riterable interface
107107
// #2005
108108
fn reversed<A:copy,IA:iterable<A>>(self: IA, blk: fn(A)) {
109-
vec::riter(to_list(self), blk)
109+
vec::riter(to_vec(self), blk)
110110
}
111111

112112
fn count<A,IA:iterable<A>>(self: IA, x: A) -> uint {
@@ -167,17 +167,17 @@ fn test_enumerate() {
167167
}
168168

169169
#[test]
170-
fn test_map_and_to_list() {
170+
fn test_map_and_to_vec() {
171171
let a = bind vec::iter([0, 1, 2], _);
172172
let b = bind map(a, {|i| 2*i}, _);
173-
let c = to_list(b);
173+
let c = to_vec(b);
174174
assert c == [0, 2, 4];
175175
}
176176

177177
#[test]
178178
fn test_map_directly_on_vec() {
179179
let b = bind map([0, 1, 2], {|i| 2*i}, _);
180-
let c = to_list(b);
180+
let c = to_vec(b);
181181
assert c == [0, 2, 4];
182182
}
183183

@@ -187,7 +187,7 @@ fn test_filter_on_int_range() {
187187
ret (i % 2) == 0;
188188
}
189189

190-
let l = to_list(bind filter(bind int::range(0, 10, _), is_even, _));
190+
let l = to_vec(bind filter(bind int::range(0, 10, _), is_even, _));
191191
assert l == [0, 2, 4, 6, 8];
192192
}
193193

@@ -197,7 +197,7 @@ fn test_filter_on_uint_range() {
197197
ret (i % 2u) == 0u;
198198
}
199199

200-
let l = to_list(bind filter(bind uint::range(0u, 10u, _), is_even, _));
200+
let l = to_vec(bind filter(bind uint::range(0u, 10u, _), is_even, _));
201201
assert l == [0u, 2u, 4u, 6u, 8u];
202202
}
203203

@@ -211,7 +211,7 @@ fn test_filter_map() {
211211
}
212212
}
213213

214-
let l = to_list(bind filter_map(
214+
let l = to_vec(bind filter_map(
215215
bind int::range(0, 5, _), negativate_the_evens, _));
216216
assert l == [0, -2, -4];
217217
}
@@ -225,7 +225,7 @@ fn test_flat_map_with_option() {
225225

226226
let a = bind vec::iter([0, 1, 2], _);
227227
let b = bind flat_map(a, if_even, _);
228-
let c = to_list(b);
228+
let c = to_vec(b);
229229
assert c == [0, 2];
230230
}
231231

@@ -239,7 +239,7 @@ fn test_flat_map_with_list() {
239239

240240
let a = bind vec::iter([0, 1, 2, 3], _);
241241
let b = bind flat_map(a, repeat, _);
242-
let c = to_list(b);
242+
let c = to_vec(b);
243243
#debug["c = %?", c];
244244
assert c == [1, 2, 2, 3, 3, 3];
245245
}
@@ -281,7 +281,7 @@ fn test_max_empty() {
281281

282282
#[test]
283283
fn test_reversed() {
284-
assert to_list(bind reversed([1, 2, 3], _)) == [3, 2, 1];
284+
assert to_vec(bind reversed([1, 2, 3], _)) == [3, 2, 1];
285285
}
286286

287287
#[test]

0 commit comments

Comments
 (0)