1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-02 05:57:46 +00:00

clean up #![features]

For the most part, this commit removes the `collections` feature.
In some places I've removed other features where the effort to do
so was pretty low.
This commit is contained in:
kwantam 2015-04-27 14:06:13 -04:00
parent de28072140
commit 05520e69cb
8 changed files with 16 additions and 20 deletions

View file

@ -1,5 +1,5 @@
#![crate_name = "base64"] #![crate_name = "base64"]
#![feature(box_syntax, collections, rustc_private)] #![feature(box_syntax, rustc_private)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.
@ -48,7 +48,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
optflag("h", "help", "display this help text and exit"), optflag("h", "help", "display this help text and exit"),
optflag("V", "version", "output version information and exit") optflag("V", "version", "output version information and exit")
]; ];
let matches = match getopts(args.tail(), &opts) { let matches = match getopts(&args[1..], &opts) {
Ok(m) => m, Ok(m) => m,
Err(e) => { Err(e) => {
crash!(1, "error: {}", e); crash!(1, "error: {}", e);

View file

@ -1,5 +1,5 @@
#![crate_name = "basename"] #![crate_name = "basename"]
#![feature(collections, rustc_private)] #![feature(rustc_private)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.
@ -34,7 +34,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
getopts::optflag("V", "version", "output version information and exit"), getopts::optflag("V", "version", "output version information and exit"),
]; ];
let matches = match getopts::getopts(args.tail(), &opts) { let matches = match getopts::getopts(&args[1..], &opts) {
Ok(m) => m, Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f) Err(f) => crash!(1, "Invalid options\n{}", f)
}; };

View file

@ -1,7 +1,5 @@
#![crate_name = "cat"] #![crate_name = "cat"]
#![feature(collections, rustc_private)] #![feature(rustc_private, box_syntax, unsafe_destructor)]
#![feature(box_syntax, unsafe_destructor)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.
@ -42,7 +40,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"), getopts::optflag("V", "version", "output version information and exit"),
]; ];
let matches = match getopts::getopts(args.tail(), &opts) { let matches = match getopts::getopts(&args[1..], &opts) {
Ok(m) => m, Ok(m) => m,
Err(f) => panic!("Invalid options\n{}", f) Err(f) => panic!("Invalid options\n{}", f)
}; };

View file

@ -1,5 +1,5 @@
#![crate_name = "chroot"] #![crate_name = "chroot"]
#![feature(collections, rustc_private, path_ext)] #![feature(rustc_private, path_ext)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.
@ -57,7 +57,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
optflag("V", "version", "Show program's version") optflag("V", "version", "Show program's version")
]; ];
let opts = match getopts(args.tail(), &options) { let opts = match getopts(&args[1..], &options) {
Ok(m) => m, Ok(m) => m,
Err(f) => { Err(f) => {
show_error!("{}", f); show_error!("{}", f);
@ -195,7 +195,7 @@ fn set_groups_from_str(groups: &str) {
fn set_user(user: &str) { fn set_user(user: &str) {
if !user.is_empty() { if !user.is_empty() {
let user_id = get_pw_from_args(&vec!(String::from_str(user))).unwrap().pw_uid; let user_id = get_pw_from_args(&vec!(user.to_string())).unwrap().pw_uid;
let err = unsafe { setuid(user_id as libc::uid_t) }; let err = unsafe { setuid(user_id as libc::uid_t) };
if err != 0 { if err != 0 {
crash!(1, "cannot set user to {}: {}", user, Error::last_os_error()) crash!(1, "cannot set user to {}: {}", user, Error::last_os_error())

View file

@ -1,5 +1,5 @@
#![crate_name = "echo"] #![crate_name = "echo"]
#![feature(rustc_private, str_char)] #![feature(rustc_private)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.
@ -94,7 +94,7 @@ fn parse_options(args: Vec<String>, options: &mut EchoOptions) -> Option<Vec<Str
"-e" => options.escape = true, "-e" => options.escape = true,
"-E" => options.escape = false, "-E" => options.escape = false,
_ => { _ => {
if arg.len() > 1 && arg.char_at(0) == '-' { if arg.len() > 1 && arg.chars().next().unwrap_or('_') == '-' {
let mut newopts = options.clone(); let mut newopts = options.clone();
for ch in arg.chars().skip(1) { for ch in arg.chars().skip(1) {
match ch { match ch {

View file

@ -1,4 +1,5 @@
#![crate_name = "fmt"] #![crate_name = "fmt"]
#![feature(box_syntax,rustc_private,str_char,unicode,core)]
/* /*
* This file is part of `fmt` from the uutils coreutils package. * This file is part of `fmt` from the uutils coreutils package.
@ -9,9 +10,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
#![feature(box_syntax,core,rustc_private,collections,str_char,unicode)]
extern crate core;
extern crate getopts; extern crate getopts;
extern crate rustc_unicode; extern crate rustc_unicode;
extern crate unicode_width; extern crate unicode_width;
@ -87,7 +85,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
getopts::optflag("h", "help", "Display this help message and exit.") getopts::optflag("h", "help", "Display this help message and exit.")
]; ];
let matches = match getopts::getopts(args.tail(), &opts[..]) { let matches = match getopts::getopts(&args[1..], &opts[..]) {
Ok(m) => m, Ok(m) => m,
Err(f) => crash!(1, "{}\nTry `{} --help' for more information.", f, args[0]) Err(f) => crash!(1, "{}\nTry `{} --help' for more information.", f, args[0])
}; };

View file

@ -7,7 +7,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use core::iter::Peekable; use std::iter::Peekable;
use std::io::{BufRead, Lines}; use std::io::{BufRead, Lines};
use std::slice::Iter; use std::slice::Iter;
use std::str::CharRange; use std::str::CharRange;

View file

@ -1,5 +1,5 @@
#![crate_name = "sync"] #![crate_name = "sync"]
#![feature(collections, rustc_private)] #![feature(rustc_private)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.
@ -148,7 +148,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
optflag("V", "version", "output version information and exit") optflag("V", "version", "output version information and exit")
]; ];
let matches = match getopts(args.tail(), &options) { let matches = match getopts(&args[1..], &options) {
Ok(m) => { m } Ok(m) => { m }
_ => { help(program, &options); return 1 } _ => { help(program, &options); return 1 }
}; };