std: replace str::each_split* with an iterator

This commit is contained in:
Huon Wilson 2013-06-09 23:10:50 +10:00
parent 2ff6b298c5
commit 1e8982bdb2
19 changed files with 270 additions and 516 deletions

View file

@ -17,6 +17,7 @@ pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
use core::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
use core::os::mkdir_recursive;
use core::os;
use core::iterator::IteratorUtil;
/// Returns the value of RUST_PATH, as a list
/// of Paths. In general this should be read from the
@ -166,7 +167,7 @@ fn library_in_workspace(full_name: &str, short_name: &str, where: Target,
let f_name = match p_path.filename() {
Some(s) => s, None => loop
};
for f_name.each_split_char('-') |piece| {
for f_name.split_iter('-').advance |piece| {
debug!("a piece = %s", piece);
if which == 0 && piece != lib_prefix {
break;

View file

@ -29,6 +29,7 @@ extern mod syntax;
use core::prelude::*;
use core::*;
use core::iterator::IteratorUtil;
pub use core::path::Path;
use core::hashmap::HashMap;
use rustc::driver::{driver, session};
@ -161,10 +162,8 @@ impl<'self> PkgScript<'self> {
exe.to_str(), root.to_str(), "configs");
let output = run::process_output(exe.to_str(), [root.to_str(), ~"configs"]);
// Run the configs() function to get the configs
let mut cfgs = ~[];
for str::each_word(str::from_bytes(output.output)) |w| {
cfgs.push(w.to_owned());
}
let cfgs = str::from_bytes_slice(output.output).word_iter()
.transform(|w| w.to_owned()).collect();
(cfgs, output.status)
}
}