diff --git a/src/cat/cat.rs b/src/cat/cat.rs index b88f792a7..8434bb230 100644 --- a/src/cat/cat.rs +++ b/src/cat/cat.rs @@ -333,7 +333,7 @@ fn fail() -> ! { impl<'a, W: Writer> Writer for UnsafeWriter<'a, W> { fn write(&mut self, buf: &[u8]) -> IoResult<()> { - let dst = self.buf.mut_slice_from(self.pos); + let dst = self.buf.slice_from_mut(self.pos); if buf.len() > dst.len() { fail(); } diff --git a/src/common/c_types.rs b/src/common/c_types.rs index a2de63100..94124cfc1 100644 --- a/src/common/c_types.rs +++ b/src/common/c_types.rs @@ -14,7 +14,7 @@ use self::libc::funcs::posix88::unistd::getgroups; use std::vec::Vec; use std::os; -use std::ptr::{mut_null, read}; +use std::ptr::{null_mut, read}; use std::string::raw::from_buf; #[cfg(target_os = "macos")] @@ -183,7 +183,7 @@ unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut } pub fn get_groups() -> Result, int> { - let ngroups = unsafe { getgroups(0, mut_null()) }; + let ngroups = unsafe { getgroups(0, null_mut()) }; if ngroups == -1 { return Err(os::errno()); } diff --git a/src/cut/buffer.rs b/src/cut/buffer.rs index fc441dd29..4006782af 100644 --- a/src/cut/buffer.rs +++ b/src/cut/buffer.rs @@ -38,7 +38,7 @@ impl BufReader { #[inline] fn read(&mut self) -> IoResult { - let buffer_fill = self.buffer.mut_slice_from(self.end); + let buffer_fill = self.buffer.slice_from_mut(self.end); match self.reader.read(buffer_fill) { Ok(nread) => { diff --git a/src/du/du.rs b/src/du/du.rs index e65db0913..14f8915a7 100644 --- a/src/du/du.rs +++ b/src/du/du.rs @@ -56,7 +56,7 @@ fn du(path: &Path, mut my_stat: Stat, } }; - for f in read.move_iter() { + for f in read.into_iter() { let this_stat = Stat{path: f.clone(), fstat: safe_unwrap!(fs::lstat(&f))}; if this_stat.fstat.kind == TypeDirectory { let oa_clone = options.clone(); @@ -71,8 +71,8 @@ fn du(path: &Path, mut my_stat: Stat, } } - for future in futures.mut_iter() { - for stat in future.get().move_iter().rev() { + for future in futures.iter_mut() { + for stat in future.get().into_iter().rev() { if !options.separate_dirs && stat.path.dir_path() == my_stat.path { my_stat.fstat.size += stat.fstat.size; my_stat.fstat.unstable.blocks += stat.fstat.unstable.blocks; @@ -310,10 +310,10 @@ Try '{} --help' for more information.", s, program); }; let mut grand_total = 0; - for path_str in strs.move_iter() { + for path_str in strs.into_iter() { let path = Path::new(path_str); let stat = safe_unwrap!(fs::lstat(&path)); - let iter = du(&path, Stat{path: path.clone(), fstat: stat}, options_arc.clone(), 0).move_iter(); + let iter = du(&path, Stat{path: path.clone(), fstat: stat}, options_arc.clone(), 0).into_iter(); let (_, len) = iter.size_hint(); let len = len.unwrap(); for (index, stat) in iter.enumerate() { diff --git a/src/echo/echo.rs b/src/echo/echo.rs index 2a09a14a8..956f25a3a 100644 --- a/src/echo/echo.rs +++ b/src/echo/echo.rs @@ -81,7 +81,7 @@ fn convert_str(string: &[u8], index: uint, base: uint) -> (char, uint) { fn parse_options(args: Vec, options: &mut EchoOptions) -> Option> { let mut echo_args = vec!(); let program = args[0].clone(); - 'argloop: for arg in args.move_iter().skip(1) { + 'argloop: for arg in args.into_iter().skip(1) { match arg.as_slice() { "--help" | "-h" => { print_help(&program); diff --git a/src/expand/expand.rs b/src/expand/expand.rs index 8c32490e4..211adc580 100644 --- a/src/expand/expand.rs +++ b/src/expand/expand.rs @@ -28,7 +28,7 @@ static DEFAULT_TABSTOP: uint = 8; fn tabstops_parse(s: String) -> Vec { let words = s.as_slice().split(',').collect::>(); - let nums = words.move_iter() + let nums = words.into_iter() .map(|sn| from_str::from_str::(sn) .unwrap_or_else( || crash!(1, "{}\n", "tab size contains invalid character(s)")) @@ -131,7 +131,7 @@ fn to_next_stop(tabstops: &[uint], col: uint) -> uint { fn expand(options: Options) { let mut output = io::stdout(); - for file in options.files.move_iter() { + for file in options.files.into_iter() { let mut col = 0; let mut init = true; for c in open(file).chars() { diff --git a/src/paste/paste.rs b/src/paste/paste.rs index 69282cf59..e489024e4 100644 --- a/src/paste/paste.rs +++ b/src/paste/paste.rs @@ -57,7 +57,7 @@ pub fn uumain(args: Vec) -> int { } fn paste(filenames: Vec, serial: bool, delimiters: &str) { - let mut files: Vec>> = filenames.move_iter().map(|name| + let mut files: Vec>> = filenames.into_iter().map(|name| io::BufferedReader::new( if name.as_slice() == "-" { box io::stdio::stdin_raw() as Box @@ -69,7 +69,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { let delimiters: Vec = delimiters.chars().map(|x| x.to_string()).collect(); let mut delim_count = 0; if serial { - for file in files.mut_iter() { + for file in files.iter_mut() { let mut output = String::new(); loop { match file.read_line() { @@ -92,7 +92,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { loop { let mut output = "".to_string(); let mut eof_count = 0; - for (i, file) in files.mut_iter().enumerate() { + for (i, file) in files.iter_mut().enumerate() { if eof[i] { eof_count += 1; } else { diff --git a/src/printenv/printenv.rs b/src/printenv/printenv.rs index b305d4746..faa4e37bf 100644 --- a/src/printenv/printenv.rs +++ b/src/printenv/printenv.rs @@ -63,7 +63,7 @@ pub fn uumain(args: Vec) -> int { pub fn exec(args: Vec, separator: &str) { if args.is_empty() { let vars = os::env(); - for (env_var, value) in vars.move_iter() { + for (env_var, value) in vars.into_iter() { print!("{0:s}={1:s}", env_var, value); print(separator); } diff --git a/src/seq/seq.rs b/src/seq/seq.rs index 0f948f21b..c6eb9106a 100644 --- a/src/seq/seq.rs +++ b/src/seq/seq.rs @@ -37,7 +37,7 @@ fn escape_sequences(s: &str) -> String { fn parse_options(args: Vec, options: &mut SeqOptions) -> Result, int> { let mut seq_args = vec!(); let program = args[0].clone(); - let mut iter = args.move_iter().skip(1); + let mut iter = args.into_iter().skip(1); loop { match iter.next() { Some(arg) => match arg.as_slice() { diff --git a/src/shuf/shuf.rs b/src/shuf/shuf.rs index 33f478072..46a1213bc 100644 --- a/src/shuf/shuf.rs +++ b/src/shuf/shuf.rs @@ -125,7 +125,7 @@ fn shuf(input: Vec, mode: Mode, repeat: bool, zero: bool, count: uint, o Echo => shuf_lines(input, repeat, zero, count, output, random), InputRange(range) => shuf_lines(range.map(|num| num.to_string()).collect(), repeat, zero, count, output, random), Default => { - let lines: Vec = input.move_iter().flat_map(|filename| { + let lines: Vec = input.into_iter().flat_map(|filename| { let slice = filename.as_slice(); let mut file_buf; let mut stdin_buf; @@ -144,7 +144,7 @@ fn shuf(input: Vec, mode: Mode, repeat: bool, zero: bool, count: uint, o line.pop_char(); lines.push(line); } - lines.move_iter() + lines.into_iter() }).collect(); shuf_lines(lines, repeat, zero, count, output, random) } diff --git a/src/tac/tac.rs b/src/tac/tac.rs index 847ad1387..d2972682a 100644 --- a/src/tac/tac.rs +++ b/src/tac/tac.rs @@ -70,7 +70,7 @@ pub fn uumain(args: Vec) -> int { } fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { - for filename in filenames.move_iter() { + for filename in filenames.into_iter() { let mut file = io::BufferedReader::new( if filename.as_slice() == "-" { box io::stdio::stdin_raw() as Box diff --git a/src/tee/tee.rs b/src/tee/tee.rs index 0f6b6628d..3e5445f97 100644 --- a/src/tee/tee.rs +++ b/src/tee/tee.rs @@ -59,7 +59,7 @@ fn options(args: &[String]) -> Result { let help = format!("{}\n\nUsage:\n {} {}\n\n{}\n{}", version, program, arguments, usage(brief, opts), comment); - let names = m.free.clone().move_iter().collect::>().append_one("-".to_string()); + let names = m.free.clone().into_iter().collect::>().append_one("-".to_string()); let to_print = if m.opt_present("help") { Some(help) } else if m.opt_present("version") { Some(version) } else { None }; diff --git a/src/unexpand/unexpand.rs b/src/unexpand/unexpand.rs index 1c13edd15..f6c20bf5c 100644 --- a/src/unexpand/unexpand.rs +++ b/src/unexpand/unexpand.rs @@ -28,7 +28,7 @@ static DEFAULT_TABSTOP: uint = 8; fn tabstops_parse(s: String) -> Vec { let words = s.as_slice().split(',').collect::>(); - let nums = words.move_iter() + let nums = words.into_iter() .map(|sn| from_str::from_str::(sn) .unwrap_or_else( || crash!(1, "{}\n", "tab size contains invalid character(s)")) @@ -156,7 +156,7 @@ fn unexpand(options: Options) { let mut output = io::stdout(); let ts = options.tabstops.as_slice(); - for file in options.files.move_iter() { + for file in options.files.into_iter() { let mut col = 0; let mut nspaces = 0; let mut init = true; diff --git a/src/uptime/uptime.rs b/src/uptime/uptime.rs index 46ea48cbb..283e6cb82 100644 --- a/src/uptime/uptime.rs +++ b/src/uptime/uptime.rs @@ -19,7 +19,7 @@ extern crate libc; use std::mem::transmute; use std::io::{print, File}; -use std::ptr::{mut_null, null}; +use std::ptr::{null_mut, null}; use std::from_str::from_str; use libc::{time_t, c_double, c_int, c_char}; use c_types::c_tm; @@ -143,7 +143,7 @@ fn print_nusers(nusers: uint) { } fn print_time() { - let local_time = unsafe { *localtime(&time(mut_null())) }; + let local_time = unsafe { *localtime(&time(null_mut())) }; if local_time.tm_hour >= 0 && local_time.tm_min >= 0 && local_time.tm_sec >= 0 { @@ -160,7 +160,7 @@ fn get_uptime(boot_time: Option) -> i64 { Ok(s) => s, _ => return match boot_time { Some(t) => { - let now = unsafe { time(mut_null()) }; + let now = unsafe { time(null_mut()) }; ((now - t) * 100) as i64 // Return in ms }, _ => -1