diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-08-03 12:45:23 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-03 22:48:02 -0400 |
| commit | 10089455287dcc3652b984ab4bfd6971e1b5f302 (patch) | |
| tree | a9570eacf4ff89a1f14b7380c080af77918589f6 /src/librustpkg | |
| parent | 9f74217d80290d1cb36afcaf68a566b4b4907d27 (diff) | |
| download | rust-10089455287dcc3652b984ab4bfd6971e1b5f302.tar.gz rust-10089455287dcc3652b984ab4bfd6971e1b5f302.zip | |
remove obsolete `foreach` keyword
this has been replaced by `for`
Diffstat (limited to 'src/librustpkg')
| -rw-r--r-- | src/librustpkg/installed_packages.rs | 6 | ||||
| -rw-r--r-- | src/librustpkg/package_source.rs | 6 | ||||
| -rw-r--r-- | src/librustpkg/path_util.rs | 12 | ||||
| -rw-r--r-- | src/librustpkg/rustpkg.rs | 4 | ||||
| -rw-r--r-- | src/librustpkg/tests.rs | 10 | ||||
| -rw-r--r-- | src/librustpkg/util.rs | 10 | ||||
| -rw-r--r-- | src/librustpkg/version.rs | 8 | ||||
| -rw-r--r-- | src/librustpkg/workspace.rs | 2 |
8 files changed, 29 insertions, 29 deletions
diff --git a/src/librustpkg/installed_packages.rs b/src/librustpkg/installed_packages.rs index 942e622b140..cec64f36947 100644 --- a/src/librustpkg/installed_packages.rs +++ b/src/librustpkg/installed_packages.rs @@ -15,16 +15,16 @@ use std::os; pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool { let workspaces = rust_path(); - foreach p in workspaces.iter() { + for p in workspaces.iter() { let binfiles = os::list_dir(&p.push("bin")); - foreach exec in binfiles.iter() { + for exec in binfiles.iter() { let exec_path = Path(*exec).filestem(); do exec_path.iter().advance |s| { f(&PkgId::new(*s, p)) }; } let libfiles = os::list_dir(&p.push("lib")); - foreach lib in libfiles.iter() { + for lib in libfiles.iter() { debug!("Full name: %s", *lib); let lib_path = Path(*lib).filestem(); do lib_path.iter().advance |s| { diff --git a/src/librustpkg/package_source.rs b/src/librustpkg/package_source.rs index 7c12645b2b2..bbe35ee5004 100644 --- a/src/librustpkg/package_source.rs +++ b/src/librustpkg/package_source.rs @@ -135,7 +135,7 @@ impl PkgSrc { return true; } else { - foreach pth in self_id.iter() { + for pth in self_id.iter() { if pth.starts_with("rust_") // because p is already normalized && match p.filestem() { Some(s) => str::eq_slice(s, pth.slice(5, pth.len())), @@ -149,7 +149,7 @@ impl PkgSrc { fn push_crate(cs: &mut ~[Crate], prefix: uint, p: &Path) { assert!(p.components.len() > prefix); let mut sub = Path(""); - foreach c in p.components.slice(prefix, p.components.len()).iter() { + for c in p.components.slice(prefix, p.components.len()).iter() { sub = sub.push(*c); } debug!("found crate %s", sub.to_str()); @@ -207,7 +207,7 @@ impl PkgSrc { crates: &[Crate], cfgs: &[~str], what: OutputType) { - foreach crate in crates.iter() { + for crate in crates.iter() { let path = &src_dir.push_rel(&crate.file).normalize(); note(fmt!("build_crates: compiling %s", path.to_str())); note(fmt!("build_crates: destination dir is %s", dst_dir.to_str())); diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs index ef95adf8c17..fdfa29b2f83 100644 --- a/src/librustpkg/path_util.rs +++ b/src/librustpkg/path_util.rs @@ -61,7 +61,7 @@ pub fn rust_path() -> ~[Path] { // Avoid adding duplicates // could still add dups if someone puts one of these in the RUST_PATH // manually, though... - foreach hdir in h.iter() { + for hdir in h.iter() { if !(cwd.is_ancestor_of(hdir) || hdir.is_ancestor_of(&cwd)) { push_if_exists(&mut env_rust_path, hdir); } @@ -100,7 +100,7 @@ pub fn make_dir_rwx(p: &Path) -> bool { os::make_dir(p, U_RWX) } pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool { let src_dir = workspace.push("src"); let dirs = os::list_dir(&src_dir); - foreach p in dirs.iter() { + for p in dirs.iter() { let p = Path((*p).clone()); debug!("=> p = %s", p.to_str()); if !os::path_is_dir(&src_dir.push_rel(&p)) { @@ -113,7 +113,7 @@ pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool { } else { let pf = p.filename(); - foreach pf in pf.iter() { + for pf in pf.iter() { let f_ = (*pf).clone(); let g = f_.to_str(); match split_version_general(g, '-') { @@ -150,7 +150,7 @@ pub fn pkgid_src_in_workspace(pkgid: &PkgId, workspace: &Path) -> ~[Path] { /// Returns a src for pkgid that does exist -- None if none of them do pub fn first_pkgid_src_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> { let rs = pkgid_src_in_workspace(pkgid, workspace); - foreach p in rs.iter() { + for p in rs.iter() { if os::path_exists(p) { return Some((*p).clone()); } @@ -246,7 +246,7 @@ pub fn library_in_workspace(path: &LocalPath, short_name: &str, where: Target, debug!("lib_prefix = %s and lib_filetype = %s", lib_prefix, lib_filetype); let mut result_filename = None; - foreach p in dir_contents.iter() { + for p in dir_contents.iter() { let mut which = 0; let mut hash = None; let p_path = Path((*p).clone()); @@ -261,7 +261,7 @@ pub fn library_in_workspace(path: &LocalPath, short_name: &str, where: Target, let f_name = match p_path.filename() { Some(s) => s, None => loop }; - foreach piece in f_name.split_iter('-') { + for piece in f_name.split_iter('-') { debug!("a piece = %s", piece); if which == 0 && piece != lib_prefix { break; diff --git a/src/librustpkg/rustpkg.rs b/src/librustpkg/rustpkg.rs index c86d10bc3e7..4d6033de54d 100644 --- a/src/librustpkg/rustpkg.rs +++ b/src/librustpkg/rustpkg.rs @@ -434,14 +434,14 @@ impl CtxMethods for Ctx { target_exec.to_str(), target_lib, maybe_executable, maybe_library); - foreach exec in maybe_executable.iter() { + for exec in maybe_executable.iter() { debug!("Copying: %s -> %s", exec.to_str(), target_exec.to_str()); if !(os::mkdir_recursive(&target_exec.dir_path(), U_RWX) && os::copy_file(exec, &target_exec)) { cond.raise(((*exec).clone(), target_exec.clone())); } } - foreach lib in maybe_library.iter() { + for lib in maybe_library.iter() { let target_lib = target_lib.clone().expect(fmt!("I built %s but apparently \ didn't install it!", lib.to_str())); debug!("Copying: %s -> %s", lib.to_str(), target_lib.to_str()); diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 6b174836a68..828be5dce12 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -356,7 +356,7 @@ fn command_line_test_output(args: &[~str]) -> ~[~str] { let mut result = ~[]; let p_output = command_line_test(args, &os::getcwd()); let test_output = str::from_bytes(p_output.output); - foreach s in test_output.split_iter('\n') { + for s in test_output.split_iter('\n') { result.push(s.to_owned()); } result @@ -366,7 +366,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~ let mut result = ~[]; let p_output = command_line_test_with_env(args, &os::getcwd(), Some(env)); let test_output = str::from_bytes(p_output.output); - foreach s in test_output.split_iter('\n') { + for s in test_output.split_iter('\n') { result.push(s.to_owned()); } result @@ -391,7 +391,7 @@ fn touch_source_file(workspace: &Path, pkgid: &PkgId) { use conditions::bad_path::cond; let pkg_src_dir = workspace.push("src").push(pkgid.to_str()); let contents = os::list_dir_path(&pkg_src_dir); - foreach p in contents.iter() { + for p in contents.iter() { if p.filetype() == Some(~".rs") { // should be able to do this w/o a process if run::process_output("touch", [p.to_str()]).status != 0 { @@ -408,7 +408,7 @@ fn frob_source_file(workspace: &Path, pkgid: &PkgId) { let pkg_src_dir = workspace.push("src").push(pkgid.to_str()); let contents = os::list_dir_path(&pkg_src_dir); let mut maybe_p = None; - foreach p in contents.iter() { + for p in contents.iter() { if p.filetype() == Some(~".rs") { maybe_p = Some(p); break; @@ -811,7 +811,7 @@ fn rust_path_contents() { assert!(p.contains(&cwd)); assert!(p.contains(&parent)); assert!(p.contains(&grandparent)); - foreach a_path in p.iter() { + for a_path in p.iter() { assert!(!a_path.components.is_empty()); } }); diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 2010e1d4b79..361981289d3 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -104,12 +104,12 @@ fn fold_item(ctx: @mut ReadyCtx, let mut cmds = ~[]; let mut had_pkg_do = false; - foreach attr in item.attrs.iter() { + for attr in item.attrs.iter() { if "pkg_do" == attr.name() { had_pkg_do = true; match attr.node.value.node { ast::MetaList(_, ref mis) => { - foreach mi in mis.iter() { + for mi in mis.iter() { match mi.node { ast::MetaWord(cmd) => cmds.push(cmd.to_owned()), _ => {} @@ -210,7 +210,7 @@ pub fn compile_input(ctxt: &Ctx, let addl_lib_search_paths = @mut options.addl_lib_search_paths; // Make sure all the library directories actually exist, since the linker will complain // otherwise - foreach p in addl_lib_search_paths.iter() { + for p in addl_lib_search_paths.iter() { assert!(os::path_is_dir(p)); } @@ -274,7 +274,7 @@ pub fn compile_crate_from_input(input: &driver::input, debug!("Outputs are %? and output type = %?", outputs, sess.opts.output_type); debug!("additional libraries:"); - foreach lib in sess.opts.addl_lib_search_paths.iter() { + for lib in sess.opts.addl_lib_search_paths.iter() { debug!("an additional library: %s", lib.to_str()); } let analysis = driver::phase_3_run_analysis_passes(sess, crate); @@ -303,7 +303,7 @@ pub fn compile_crate(ctxt: &Ctx, pkg_id: &PkgId, what: OutputType) -> bool { debug!("compile_crate: crate=%s, dir=%s", crate.to_str(), dir.to_str()); debug!("compile_crate: short_name = %s, flags =...", pkg_id.to_str()); - foreach fl in flags.iter() { + for fl in flags.iter() { debug!("+++ %s", *fl); } compile_input(ctxt, pkg_id, crate, dir, flags, cfgs, opt, what) diff --git a/src/librustpkg/version.rs b/src/librustpkg/version.rs index d0c5c099ec4..88391850891 100644 --- a/src/librustpkg/version.rs +++ b/src/librustpkg/version.rs @@ -108,7 +108,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> { let mut output = None; let output_text = str::from_bytes(outp.output); - foreach l in output_text.line_iter() { + for l in output_text.line_iter() { if !l.is_whitespace() { output = Some(l); } @@ -142,7 +142,7 @@ pub fn try_getting_version(remote_path: &RemotePath) -> Option<Version> { ~"tag", ~"-l"]); let output_text = str::from_bytes(outp.output); debug!("Full output: ( %s ) [%?]", output_text, outp.status); - foreach l in output_text.line_iter() { + for l in output_text.line_iter() { debug!("A line of output: %s", l); if !l.is_whitespace() { output = Some(l); @@ -172,7 +172,7 @@ fn try_parsing_version(s: &str) -> Option<Version> { let s = s.trim(); debug!("Attempting to parse: %s", s); let mut parse_state = Start; - foreach c in s.iter() { + for c in s.iter() { if char::is_digit(c) { parse_state = SawDigit; } @@ -204,7 +204,7 @@ pub fn split_version<'a>(s: &'a str) -> Option<(&'a str, Version)> { pub fn split_version_general<'a>(s: &'a str, sep: char) -> Option<(&'a str, Version)> { // reject strings with multiple '#'s - foreach st in s.split_iter(sep) { + for st in s.split_iter(sep) { debug!("whole = %s part = %s", s, st); } if s.split_iter(sep).len_() > 2 { diff --git a/src/librustpkg/workspace.rs b/src/librustpkg/workspace.rs index 3417d051e62..d877b4ff489 100644 --- a/src/librustpkg/workspace.rs +++ b/src/librustpkg/workspace.rs @@ -26,7 +26,7 @@ pub fn each_pkg_parent_workspace(pkgid: &PkgId, action: &fn(&Path) -> bool) -> b pkgid.remote_path.to_str(), rust_path().to_str()); } - foreach ws in workspaces.iter() { + for ws in workspaces.iter() { if action(ws) { break; } |
