From b6086641357ce783418f600ee8efba6b2ea3a7ae Mon Sep 17 00:00:00 2001 From: Arcterus Date: Sun, 23 Feb 2014 13:31:51 -0800 Subject: [PATCH] Update for latest Rust --- du/du.rs | 6 +++--- env/env.rs | 28 +++++++++++++--------------- id/id.rs | 4 +++- users/users.rs | 2 +- whoami/whoami.rs | 2 ++ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/du/du.rs b/du/du.rs index 482b1fd15..2397385aa 100644 --- a/du/du.rs +++ b/du/du.rs @@ -11,16 +11,16 @@ #[feature(macro_rules)]; -extern crate extra; extern crate getopts; extern crate sync; +extern crate time; use std::os; use std::io::fs; use std::io::FileStat; use std::option::Option; use std::path::Path; -use extra::time::Timespec; +use time::Timespec; use sync::{Arc, Future}; #[path = "../util.rs"] @@ -337,7 +337,7 @@ Try 'du --help' for more information."); ((time / 1000) as i64, (time % 1000 * 1000000) as i32) }; let time_spec = Timespec::new(secs, nsecs); - extra::time::at(time_spec).strftime(time_format_str) + time::at(time_spec).strftime(time_format_str) }; print!("{:<10} {:<30} {}", convert_size(size), time_str, stat.path.display()); } else { diff --git a/env/env.rs b/env/env.rs index e4cd4b7be..78b998174 100644 --- a/env/env.rs +++ b/env/env.rs @@ -11,6 +11,8 @@ /* last synced with: env (GNU coreutils) 8.13 */ +#[allow(non_camel_case_types)]; + struct options { ignore_env: bool, null: bool, @@ -188,21 +190,17 @@ fn main() { std::os::setenv(name.as_slice(), val.as_slice()) } - match opts.program { - [ref prog, ..args] => { - match std::run::process_status(prog.as_slice(), args.as_slice()) { - Ok(exit) => - std::os::set_exit_status(match exit { - std::io::process::ExitStatus(s) => s, - _ => 1 - }), - Err(_) => std::os::set_exit_status(1) - } - } - - [] => { - // no program provided - print_env(opts.null); + if opts.program.len() >= 1 { + match std::run::process_status(opts.program[0].as_slice(), opts.program.slice_from(1)) { + Ok(exit) => + std::os::set_exit_status(match exit { + std::io::process::ExitStatus(s) => s, + _ => 1 + }), + Err(_) => std::os::set_exit_status(1) } + } else { + // no program provided + print_env(opts.null); } } diff --git a/id/id.rs b/id/id.rs index f0169e8e6..c062954f0 100644 --- a/id/id.rs +++ b/id/id.rs @@ -13,6 +13,8 @@ * http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c */ +#[allow(non_camel_case_types)]; + extern crate getopts; use std::{libc, os, vec}; @@ -41,7 +43,7 @@ struct c_group { #[cfg(not(target_os = "linux"))] mod audit { - pub use std::unstable::intrinsics::uninit; + pub use std::mem::uninit; use std::libc::{uid_t, pid_t, c_int, c_uint, uint64_t, dev_t}; pub type au_id_t = uid_t; diff --git a/users/users.rs b/users/users.rs index 00c82a7d7..5cf466ef9 100644 --- a/users/users.rs +++ b/users/users.rs @@ -12,7 +12,7 @@ /* last synced with: whoami (GNU coreutils) 8.22 */ // Allow dead code here in order to keep all fields, constants here, for consistency. -#[allow(dead_code)]; +#[allow(dead_code, non_camel_case_types)]; #[feature(macro_rules, globs)]; diff --git a/whoami/whoami.rs b/whoami/whoami.rs index 9369cbf0c..b6a466336 100644 --- a/whoami/whoami.rs +++ b/whoami/whoami.rs @@ -11,6 +11,8 @@ /* last synced with: whoami (GNU coreutils) 8.21 */ +#[allow(non_camel_case_types)]; + #[feature(macro_rules)]; extern crate extra;