From 448f4d6d700a6f731eda9516421e1cd782876634 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Fri, 30 May 2014 10:35:54 +0200 Subject: [PATCH] remove remaining uses of ~[T] --- base64/base64.rs | 2 +- basename/basename.rs | 2 +- cp/cp.rs | 2 +- dirname/dirname.rs | 2 +- du/du.rs | 2 +- echo/echo.rs | 2 +- kill/kill.rs | 2 +- logname/logname.rs | 2 +- mkdir/mkdir.rs | 2 +- paste/paste.rs | 2 +- printenv/printenv.rs | 2 +- pwd/pwd.rs | 2 +- rm/rm.rs | 2 +- rmdir/rmdir.rs | 2 +- seq/seq.rs | 4 ++-- sleep/sleep.rs | 2 +- sum/sum.rs | 4 ++-- tac/tac.rs | 2 +- tee/tee.rs | 2 +- touch/touch.rs | 2 +- truncate/truncate.rs | 2 +- uname/uname.rs | 2 +- unlink/unlink.rs | 2 +- uptime/uptime.rs | 2 +- users/users.rs | 2 +- wc/wc.rs | 2 +- whoami/whoami.rs | 2 +- yes/yes.rs | 2 +- 28 files changed, 30 insertions(+), 30 deletions(-) diff --git a/base64/base64.rs b/base64/base64.rs index 48ec40a67..dc7da32b0 100644 --- a/base64/base64.rs +++ b/base64/base64.rs @@ -36,7 +36,7 @@ mod util; static NAME: &'static str = "base64"; pub fn uumain(args: Vec) { - let opts = ~[ + let opts = [ optflag("d", "decode", "decode data"), optflag("i", "ignore-garbage", "when decoding, ignore non-alphabetic characters"), optopt("w", "wrap", diff --git a/basename/basename.rs b/basename/basename.rs index be9217b5a..e3c170ba1 100644 --- a/basename/basename.rs +++ b/basename/basename.rs @@ -32,7 +32,7 @@ pub fn uumain(args: Vec) { // // Argument parsing // - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), ]; diff --git a/cp/cp.rs b/cp/cp.rs index 8bb6ccf18..87f89b56c 100644 --- a/cp/cp.rs +++ b/cp/cp.rs @@ -35,7 +35,7 @@ pub enum Mode { fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { - let opts = ~[ + let opts = [ optflag("h", "help", "display this help and exit"), optflag("", "version", "output version information and exit"), ]; diff --git a/dirname/dirname.rs b/dirname/dirname.rs index bebf57545..196d7bef4 100644 --- a/dirname/dirname.rs +++ b/dirname/dirname.rs @@ -21,7 +21,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("z", "zero", "separate output with NUL rather than newline"), getopts::optflag("", "help", "display this help and exit"), getopts::optflag("", "version", "output version information and exit"), diff --git a/du/du.rs b/du/du.rs index 14dfec99d..055e1d211 100644 --- a/du/du.rs +++ b/du/du.rs @@ -95,7 +95,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).as_slice(); - let opts = ~[ + let opts = [ // In task getopts::optflag("a", "all", " write counts for all files, not just directories"), // In main diff --git a/echo/echo.rs b/echo/echo.rs index deb920a4f..75e798593 100644 --- a/echo/echo.rs +++ b/echo/echo.rs @@ -74,7 +74,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("n", "", "do not output the trailing newline"), getopts::optflag("e", "", "enable interpretation of backslash escapes"), getopts::optflag("E", "", "disable interpretation of backslash escapes (default)"), diff --git a/kill/kill.rs b/kill/kill.rs index 0cf73c9ef..f2dbe8b3e 100644 --- a/kill/kill.rs +++ b/kill/kill.rs @@ -57,7 +57,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { - let opts = ~[ + let opts = [ optflag("h", "help", "display this help and exit"), optflag("V", "version", "output version information and exit"), optopt("s", "signal", "specify the to be sent", "SIGNAL"), diff --git a/logname/logname.rs b/logname/logname.rs index d237f1615..1e6ea6650 100644 --- a/logname/logname.rs +++ b/logname/logname.rs @@ -52,7 +52,7 @@ pub fn uumain(args: Vec) { // // Argument parsing // - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), ]; diff --git a/mkdir/mkdir.rs b/mkdir/mkdir.rs index ba71264b8..eb88c1942 100644 --- a/mkdir/mkdir.rs +++ b/mkdir/mkdir.rs @@ -33,7 +33,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { - let opts = ~[ + let opts = [ // Linux-specific options, not implemented // getopts::optflag("Z", "context", "set SELinux secutiry context" + // " of each created directory to CTX"), diff --git a/paste/paste.rs b/paste/paste.rs index 202d62ffa..31b55d681 100644 --- a/paste/paste.rs +++ b/paste/paste.rs @@ -29,7 +29,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("s", "serial", "paste one file at a time instead of in parallel"), getopts::optopt("d", "delimiters", "reuse characters from LIST instead of TABs", "LIST"), getopts::optflag("h", "help", "display this help and exit"), diff --git a/printenv/printenv.rs b/printenv/printenv.rs index 20ff04afc..1df80e271 100644 --- a/printenv/printenv.rs +++ b/printenv/printenv.rs @@ -29,7 +29,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("0", "null", "end each output line with 0 byte rather than newline"), getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), diff --git a/pwd/pwd.rs b/pwd/pwd.rs index a0ca6fe67..e8831237c 100644 --- a/pwd/pwd.rs +++ b/pwd/pwd.rs @@ -28,7 +28,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("", "help", "display this help and exit"), getopts::optflag("", "version", "output version information and exit"), ]; diff --git a/rm/rm.rs b/rm/rm.rs index f8f62e6d6..89f838c00 100644 --- a/rm/rm.rs +++ b/rm/rm.rs @@ -36,7 +36,7 @@ pub fn uumain(args: Vec) { let program = args.get(0).clone(); // TODO: make getopts support -R in addition to -r - let opts = ~[ + let opts = [ getopts::optflag("f", "force", "ignore nonexistent files and arguments, never prompt"), getopts::optflag("i", "", "prompt before every removal"), getopts::optflag("I", "", "prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving some protection against most mistakes"), diff --git a/rmdir/rmdir.rs b/rmdir/rmdir.rs index be743412e..14052754c 100644 --- a/rmdir/rmdir.rs +++ b/rmdir/rmdir.rs @@ -28,7 +28,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("", "ignore-fail-on-non-empty", "ignore each failure that is solely because a directory is non-empty"), getopts::optflag("p", "parents", "remove DIRECTORY and its ancestors; e.g., 'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a"), getopts::optflag("v", "verbose", "output a diagnostic for every directory processed"), diff --git a/seq/seq.rs b/seq/seq.rs index b077d70d9..c0c098763 100644 --- a/seq/seq.rs +++ b/seq/seq.rs @@ -15,7 +15,7 @@ mod util; static NAME: &'static str = "seq"; -fn print_usage(opts: ~[getopts::OptGroup]) { +fn print_usage(opts: &[getopts::OptGroup]) { println!("seq 1.0.0\n"); println!("Usage:\n seq [-w] [-s string] [-t string] [first [step]] last\n"); println!("{:s}", getopts::usage("Print sequences of numbers", opts)); @@ -37,7 +37,7 @@ fn escape_sequences(s: &str) -> String { fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { - let opts = ~[ + let opts = [ getopts::optopt("s", "separator", "Separator character (defaults to \\n)", ""), getopts::optopt("t", "terminator", "Terminator character (defaults to separator)", ""), getopts::optflag("w", "widths", "Equalize widths of all numbers by padding with zeros"), diff --git a/sleep/sleep.rs b/sleep/sleep.rs index 870ca66f8..fe020fa8f 100644 --- a/sleep/sleep.rs +++ b/sleep/sleep.rs @@ -29,7 +29,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit") ]; diff --git a/sum/sum.rs b/sum/sum.rs index eb585ea1d..352f1cf44 100644 --- a/sum/sum.rs +++ b/sum/sum.rs @@ -24,7 +24,7 @@ static VERSION: &'static str = "1.0.0"; static NAME: &'static str = "sum"; fn bsd_sum(mut reader: Box) -> (uint, u16) { - let mut buf = ~[0, .. 1024]; + let mut buf = [0, .. 1024]; let mut blocks_read = 0; let mut checksum: u16 = 0; loop { @@ -44,7 +44,7 @@ fn bsd_sum(mut reader: Box) -> (uint, u16) { } fn sysv_sum(mut reader: Box) -> (uint, u16) { - let mut buf = ~[0, .. 512]; + let mut buf = [0, .. 512]; let mut blocks_read = 0; let mut ret = 0; diff --git a/tac/tac.rs b/tac/tac.rs index 1f5bef22f..7fc9f99f9 100644 --- a/tac/tac.rs +++ b/tac/tac.rs @@ -29,7 +29,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("b", "before", "attach the separator before instead of after"), getopts::optflag("r", "regex", "interpret the sequence as a regular expression (NOT IMPLEMENTED)"), getopts::optopt("s", "separator", "use STRING as the separator instead of newline", "STRING"), diff --git a/tee/tee.rs b/tee/tee.rs index 9c6791974..b4af3a42c 100644 --- a/tee/tee.rs +++ b/tee/tee.rs @@ -43,7 +43,7 @@ struct Options { } fn options(args: &[String]) -> Result { - let opts = ~[ + let opts = [ optflag("a", "append", "append to the given FILEs, do not overwrite"), optflag("i", "ignore-interrupts", "ignore interrupt signals"), optflag("h", "help", "display this help and exit"), diff --git a/touch/touch.rs b/touch/touch.rs index 3d5843edf..0886e15a2 100644 --- a/touch/touch.rs +++ b/touch/touch.rs @@ -26,7 +26,7 @@ static VERSION: &'static str = "1.0.0"; fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { - let opts = ~[ + let opts = [ getopts::optflag("a", "", "change only the access time"), getopts::optflag("c", "no-create", "do not create any files"), getopts::optopt( "d", "date", "parse argument and use it instead of current time", "STRING"), diff --git a/truncate/truncate.rs b/truncate/truncate.rs index 98e95a6d5..1188f1f54 100644 --- a/truncate/truncate.rs +++ b/truncate/truncate.rs @@ -52,7 +52,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("c", "no-create", "do not create files that do not exist"), getopts::optflag("o", "io-blocks", "treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)"), getopts::optopt("r", "reference", "base the size of each file on the size of RFILE", "RFILE"), diff --git a/uname/uname.rs b/uname/uname.rs index 5264a0283..e9c4cefff 100644 --- a/uname/uname.rs +++ b/uname/uname.rs @@ -56,7 +56,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).as_slice(); - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("a", "all", "Behave as though all of the options -mnrsv were specified."), getopts::optflag("m", "machine", "print the machine hardware name."), diff --git a/unlink/unlink.rs b/unlink/unlink.rs index 29ab49092..fc879bda7 100644 --- a/unlink/unlink.rs +++ b/unlink/unlink.rs @@ -31,7 +31,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), ]; diff --git a/uptime/uptime.rs b/uptime/uptime.rs index e71bd53b9..f131fbf05 100644 --- a/uptime/uptime.rs +++ b/uptime/uptime.rs @@ -52,7 +52,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("v", "version", "output version information and exit"), getopts::optflag("h", "help", "display this help and exit"), ]; diff --git a/users/users.rs b/users/users.rs index 38aae3fd8..fc048153d 100644 --- a/users/users.rs +++ b/users/users.rs @@ -52,7 +52,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).as_slice(); - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), ]; diff --git a/wc/wc.rs b/wc/wc.rs index 4d5d6eca8..5ee9a92b2 100644 --- a/wc/wc.rs +++ b/wc/wc.rs @@ -38,7 +38,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("c", "bytes", "print the byte counts"), getopts::optflag("m", "chars", "print the character counts"), getopts::optflag("l", "lines", "print the newline counts"), diff --git a/whoami/whoami.rs b/whoami/whoami.rs index dc1379279..de5fe345c 100644 --- a/whoami/whoami.rs +++ b/whoami/whoami.rs @@ -46,7 +46,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).as_slice(); - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), ]; diff --git a/yes/yes.rs b/yes/yes.rs index 88d58d797..b03b9ae5c 100644 --- a/yes/yes.rs +++ b/yes/yes.rs @@ -29,7 +29,7 @@ fn main() { uumain(os::args()); } pub fn uumain(args: Vec) { let program = args.get(0).clone(); - let opts = ~[ + let opts = [ getopts::optflag("h", "help", "display this help and exit"), getopts::optflag("V", "version", "output version information and exit"), ];