diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index aa20c1556ed4..a6306c33eb9c 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -102,7 +102,7 @@ pub fn build_sized_opt(size: Option, #[inline(always)] pub fn append(lhs: @[T], rhs: &const [T]) -> @[T] { do build_sized(lhs.len() + rhs.len()) |push| { - for vec::each(lhs) |x| { push(*x); } + for lhs.each |x| { push(*x); } for uint::range(0, rhs.len()) |i| { push(rhs[i]); } } } @@ -111,7 +111,7 @@ pub fn append(lhs: @[T], rhs: &const [T]) -> @[T] { /// Apply a function to each element of a vector and return the results pub fn map(v: &[T], f: &fn(x: &T) -> U) -> @[U] { do build_sized(v.len()) |push| { - for vec::each(v) |elem| { + for v.each |elem| { push(f(elem)); } } diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 33b7e81ee85f..957e848b5e7d 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -44,7 +44,7 @@ pub fn lefts(eithers: &[Either]) -> ~[T] { //! Extracts from a vector of either all the left values do vec::build_sized(eithers.len()) |push| { - for vec::each(eithers) |elt| { + for eithers.each |elt| { match *elt { Left(ref l) => { push(*l); } _ => { /* fallthrough */ } @@ -57,7 +57,7 @@ pub fn rights(eithers: &[Either]) -> ~[U] { //! Extracts from a vector of either all the right values do vec::build_sized(eithers.len()) |push| { - for vec::each(eithers) |elt| { + for eithers.each |elt| { match *elt { Right(ref r) => { push(*r); } _ => { /* fallthrough */ } diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index d535abf8ead7..e00fb33fad94 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -378,7 +378,7 @@ impl Streaming for SipState { fn result_str(&mut self) -> ~str { let r = self.result_bytes(); let mut s = ~""; - for vec::each(r) |b| { + for r.each |b| { s += uint::to_str_radix(*b as uint, 16u); } s @@ -478,7 +478,7 @@ mod tests { fn to_hex_str(r: &[u8, ..8]) -> ~str { let mut s = ~""; - for vec::each(*r) |b| { + for (*r).each |b| { s += uint::to_str_radix(*b as uint, 16u); } s diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 1bb754fc2be4..7fc2c2559c24 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1200,7 +1200,7 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag]) fn wb() -> c_int { O_WRONLY as c_int } let mut fflags: c_int = wb(); - for vec::each(flags) |f| { + for flags.each |f| { match *f { Append => fflags |= O_APPEND as c_int, Create => fflags |= O_CREAT as c_int, diff --git a/src/libcore/os.rs b/src/libcore/os.rs index afb964148585..574618026d98 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -1491,7 +1491,7 @@ mod tests { fn test_env_getenv() { let e = env(); assert!(vec::len(e) > 0u); - for vec::each(e) |p| { + for e.each |p| { let (n, v) = copy *p; debug!(copy n); let v2 = getenv(n); @@ -1583,7 +1583,7 @@ mod tests { // Just assuming that we've got some contents in the current directory assert!((vec::len(dirs) > 0u)); - for vec::each(dirs) |dir| { + for dirs.each |dir| { debug!(copy *dir); } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 17cc07c660d1..1d67e754a4f2 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -300,7 +300,7 @@ pub fn map_vec( ts: &[T], op: &fn(&T) -> Result) -> Result<~[V],U> { let mut vs: ~[V] = vec::with_capacity(vec::len(ts)); - for vec::each(ts) |t| { + for ts.each |t| { match op(t) { Ok(copy v) => vs.push(v), Err(copy u) => return Err(u) diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 55b6c5100dd4..fd168dc02f60 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -426,7 +426,7 @@ fn with_argv(prog: &str, args: &[~str], cb: &fn(**libc::c_char) -> T) -> T { let mut argptrs = str::as_c_str(prog, |b| ~[b]); let mut tmps = ~[]; - for vec::each(args) |arg| { + for args.each |arg| { let t = @copy *arg; tmps.push(t); argptrs.push_all(str::as_c_str(*t, |b| ~[b])); @@ -445,7 +445,7 @@ fn with_envp(env: &Option<~[(~str,~str)]>, let mut tmps = ~[]; let mut ptrs = ~[]; - for vec::each(*es) |e| { + for (*es).each |e| { let (k,v) = copy *e; let t = @(fmt!("%s=%s", k, v)); tmps.push(t); @@ -470,7 +470,7 @@ fn with_envp(env: &Option<~[(~str,~str)]>, match *env { Some(ref es) if !vec::is_empty(*es) => { let mut blk : ~[u8] = ~[]; - for vec::each(*es) |e| { + for (*es).each |e| { let (k,v) = copy *e; let t = fmt!("%s=%s", k, v); let mut v : ~[u8] = ::cast::transmute(t); diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 44c07e86814f..5ec6471ac4a2 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -189,7 +189,7 @@ pub fn from_char(ch: char) -> ~str { pub fn from_chars(chs: &[char]) -> ~str { let mut buf = ~""; reserve(&mut buf, chs.len()); - for vec::each(chs) |ch| { + for chs.each |ch| { push_char(&mut buf, *ch); } buf @@ -326,7 +326,7 @@ pub fn connect_slices(v: &[&str], sep: &str) -> ~str { do as_buf(sep) |sepbuf, seplen| { let seplen = seplen - 1; let mut buf = ::cast::transmute_mut_unsafe(buf); - for vec::each(v) |ss| { + for v.each |ss| { do as_buf(*ss) |ssbuf, sslen| { let sslen = sslen - 1; if first { @@ -2407,7 +2407,7 @@ pub mod raw { unsafe fn push_bytes(s: &mut ~str, bytes: &[u8]) { let new_len = s.len() + bytes.len(); reserve_at_least(&mut *s, new_len); - for vec::each(bytes) |byte| { push_byte(&mut *s, *byte); } + for bytes.each |byte| { push_byte(&mut *s, *byte); } } /// Removes the last byte from a string and returns it. (Not UTF-8 safe). @@ -3782,7 +3782,7 @@ mod tests { 0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16, 0x000a_u16 ]) ]; - for vec::each(pairs) |p| { + for pairs.each |p| { let (s, u) = copy *p; assert!(to_utf16(s) == u); assert!(from_utf16(u) == s);