Skip to content

Commit 9a292b3

Browse files
committed
libcore: rename vec::each(variable) to variable.each
1 parent 3bbbb31 commit 9a292b3

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

src/libcore/at_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn build_sized_opt<A>(size: Option<uint>,
102102
#[inline(always)]
103103
pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
104104
do build_sized(lhs.len() + rhs.len()) |push| {
105-
for vec::each(lhs) |x| { push(*x); }
105+
for lhs.each |x| { push(*x); }
106106
for uint::range(0, rhs.len()) |i| { push(rhs[i]); }
107107
}
108108
}
@@ -111,7 +111,7 @@ pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
111111
/// Apply a function to each element of a vector and return the results
112112
pub fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
113113
do build_sized(v.len()) |push| {
114-
for vec::each(v) |elem| {
114+
for v.each |elem| {
115115
push(f(elem));
116116
}
117117
}

src/libcore/either.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn lefts<T:Copy,U>(eithers: &[Either<T, U>]) -> ~[T] {
4444
//! Extracts from a vector of either all the left values
4545
4646
do vec::build_sized(eithers.len()) |push| {
47-
for vec::each(eithers) |elt| {
47+
for eithers.each |elt| {
4848
match *elt {
4949
Left(ref l) => { push(*l); }
5050
_ => { /* fallthrough */ }
@@ -57,7 +57,7 @@ pub fn rights<T, U: Copy>(eithers: &[Either<T, U>]) -> ~[U] {
5757
//! Extracts from a vector of either all the right values
5858
5959
do vec::build_sized(eithers.len()) |push| {
60-
for vec::each(eithers) |elt| {
60+
for eithers.each |elt| {
6161
match *elt {
6262
Right(ref r) => { push(*r); }
6363
_ => { /* fallthrough */ }

src/libcore/hash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl Streaming for SipState {
378378
fn result_str(&mut self) -> ~str {
379379
let r = self.result_bytes();
380380
let mut s = ~"";
381-
for vec::each(r) |b| {
381+
for r.each |b| {
382382
s += uint::to_str_radix(*b as uint, 16u);
383383
}
384384
s
@@ -478,7 +478,7 @@ mod tests {
478478

479479
fn to_hex_str(r: &[u8, ..8]) -> ~str {
480480
let mut s = ~"";
481-
for vec::each(*r) |b| {
481+
for (*r).each |b| {
482482
s += uint::to_str_radix(*b as uint, 16u);
483483
}
484484
s

src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
12001200
fn wb() -> c_int { O_WRONLY as c_int }
12011201

12021202
let mut fflags: c_int = wb();
1203-
for vec::each(flags) |f| {
1203+
for flags.each |f| {
12041204
match *f {
12051205
Append => fflags |= O_APPEND as c_int,
12061206
Create => fflags |= O_CREAT as c_int,

src/libcore/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ mod tests {
14911491
fn test_env_getenv() {
14921492
let e = env();
14931493
assert!(vec::len(e) > 0u);
1494-
for vec::each(e) |p| {
1494+
for e.each |p| {
14951495
let (n, v) = copy *p;
14961496
debug!(copy n);
14971497
let v2 = getenv(n);
@@ -1583,7 +1583,7 @@ mod tests {
15831583
// Just assuming that we've got some contents in the current directory
15841584
assert!((vec::len(dirs) > 0u));
15851585
1586-
for vec::each(dirs) |dir| {
1586+
for dirs.each |dir| {
15871587
debug!(copy *dir);
15881588
}
15891589
}

src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub fn map_vec<T,U:Copy,V:Copy>(
300300
ts: &[T], op: &fn(&T) -> Result<V,U>) -> Result<~[V],U> {
301301
302302
let mut vs: ~[V] = vec::with_capacity(vec::len(ts));
303-
for vec::each(ts) |t| {
303+
for ts.each |t| {
304304
match op(t) {
305305
Ok(copy v) => vs.push(v),
306306
Err(copy u) => return Err(u)

src/libcore/run.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn with_argv<T>(prog: &str, args: &[~str],
426426
cb: &fn(**libc::c_char) -> T) -> T {
427427
let mut argptrs = str::as_c_str(prog, |b| ~[b]);
428428
let mut tmps = ~[];
429-
for vec::each(args) |arg| {
429+
for args.each |arg| {
430430
let t = @copy *arg;
431431
tmps.push(t);
432432
argptrs.push_all(str::as_c_str(*t, |b| ~[b]));
@@ -445,7 +445,7 @@ fn with_envp<T>(env: &Option<~[(~str,~str)]>,
445445
let mut tmps = ~[];
446446
let mut ptrs = ~[];
447447

448-
for vec::each(*es) |e| {
448+
for (*es).each |e| {
449449
let (k,v) = copy *e;
450450
let t = @(fmt!("%s=%s", k, v));
451451
tmps.push(t);
@@ -470,7 +470,7 @@ fn with_envp<T>(env: &Option<~[(~str,~str)]>,
470470
match *env {
471471
Some(ref es) if !vec::is_empty(*es) => {
472472
let mut blk : ~[u8] = ~[];
473-
for vec::each(*es) |e| {
473+
for (*es).each |e| {
474474
let (k,v) = copy *e;
475475
let t = fmt!("%s=%s", k, v);
476476
let mut v : ~[u8] = ::cast::transmute(t);

src/libcore/str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pub fn from_char(ch: char) -> ~str {
189189
pub fn from_chars(chs: &[char]) -> ~str {
190190
let mut buf = ~"";
191191
reserve(&mut buf, chs.len());
192-
for vec::each(chs) |ch| {
192+
for chs.each |ch| {
193193
push_char(&mut buf, *ch);
194194
}
195195
buf
@@ -326,7 +326,7 @@ pub fn connect_slices(v: &[&str], sep: &str) -> ~str {
326326
do as_buf(sep) |sepbuf, seplen| {
327327
let seplen = seplen - 1;
328328
let mut buf = ::cast::transmute_mut_unsafe(buf);
329-
for vec::each(v) |ss| {
329+
for v.each |ss| {
330330
do as_buf(*ss) |ssbuf, sslen| {
331331
let sslen = sslen - 1;
332332
if first {
@@ -2407,7 +2407,7 @@ pub mod raw {
24072407
unsafe fn push_bytes(s: &mut ~str, bytes: &[u8]) {
24082408
let new_len = s.len() + bytes.len();
24092409
reserve_at_least(&mut *s, new_len);
2410-
for vec::each(bytes) |byte| { push_byte(&mut *s, *byte); }
2410+
for bytes.each |byte| { push_byte(&mut *s, *byte); }
24112411
}
24122412

24132413
/// Removes the last byte from a string and returns it. (Not UTF-8 safe).
@@ -3782,7 +3782,7 @@ mod tests {
37823782
0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16,
37833783
0x000a_u16 ]) ];
37843784

3785-
for vec::each(pairs) |p| {
3785+
for pairs.each |p| {
37863786
let (s, u) = copy *p;
37873787
assert!(to_utf16(s) == u);
37883788
assert!(from_utf16(u) == s);

0 commit comments

Comments
 (0)