diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-08-01 03:16:42 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-01 05:34:55 -0400 |
| commit | 1fc4db2d086fd068a934c9ed2ccf25456fedc216 (patch) | |
| tree | 8e96cbc62b80bd622f78cf68b0bb29cb14ebc417 /src/libstd/path.rs | |
| parent | 5f59c46e0f5605a0cc90ebdb26b4d258a8f7b43a (diff) | |
| download | rust-1fc4db2d086fd068a934c9ed2ccf25456fedc216.tar.gz rust-1fc4db2d086fd068a934c9ed2ccf25456fedc216.zip | |
migrate many `for` loops to `foreach`
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index af6bfc16e54..989a5cbd35b 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -19,7 +19,7 @@ Cross-platform file path handling use clone::Clone; use container::Container; use cmp::Eq; -use iterator::IteratorUtil; +use iterator::{Iterator, IteratorUtil}; use libc; use option::{None, Option, Some}; use str::{OwnedStr, Str, StrSlice, StrVector}; @@ -647,8 +647,8 @@ impl GenericPath for PosixPath { fn push_many<S: Str>(&self, cs: &[S]) -> PosixPath { let mut v = self.components.clone(); - for cs.iter().advance |e| { - for e.as_slice().split_iter(posix::is_sep).advance |s| { + foreach e in cs.iter() { + foreach s in e.as_slice().split_iter(posix::is_sep) { if !s.is_empty() { v.push(s.to_owned()) } @@ -662,7 +662,7 @@ impl GenericPath for PosixPath { fn push(&self, s: &str) -> PosixPath { let mut v = self.components.clone(); - for s.split_iter(posix::is_sep).advance |s| { + foreach s in s.split_iter(posix::is_sep) { if !s.is_empty() { v.push(s.to_owned()) } @@ -922,8 +922,8 @@ impl GenericPath for WindowsPath { fn push_many<S: Str>(&self, cs: &[S]) -> WindowsPath { let mut v = self.components.clone(); - for cs.iter().advance |e| { - for e.as_slice().split_iter(windows::is_sep).advance |s| { + foreach e in cs.iter() { + foreach s in e.as_slice().split_iter(windows::is_sep) { if !s.is_empty() { v.push(s.to_owned()) } @@ -940,7 +940,7 @@ impl GenericPath for WindowsPath { fn push(&self, s: &str) -> WindowsPath { let mut v = self.components.clone(); - for s.split_iter(windows::is_sep).advance |s| { + foreach s in s.split_iter(windows::is_sep) { if !s.is_empty() { v.push(s.to_owned()) } @@ -989,7 +989,7 @@ impl GenericPath for WindowsPath { pub fn normalize(components: &[~str]) -> ~[~str] { let mut cs = ~[]; - for components.iter().advance |c| { + foreach c in components.iter() { if *c == ~"." && components.len() > 1 { loop; } if *c == ~"" { loop; } if *c == ~".." && cs.len() != 0 { |
