1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Fix more clippy warnings and remove redundant 'static

This commit is contained in:
Vinzent Steinberg 2018-09-04 14:33:36 +02:00
parent 4034a322a2
commit e46e3594d2
86 changed files with 316 additions and 334 deletions

View file

@ -15,9 +15,9 @@ extern crate uucore;
use platform_info::*;
static SYNTAX: &'static str = "";
static SUMMARY: &'static str = "Determine architecture name for current machine.";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "";
static SUMMARY: &str = "Determine architecture name for current machine.";
static LONG_HELP: &str = "";
pub fn uumain(args: Vec<String>) -> i32 {
new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);

View file

@ -16,10 +16,10 @@ use std::fs::File;
use std::io::{stdin, BufReader, Read};
use std::path::Path;
static SYNTAX: &'static str = "[OPTION]... [FILE]";
static SUMMARY: &'static str =
static SYNTAX: &str = "[OPTION]... [FILE]";
static SUMMARY: &str =
"Base32 encode or decode FILE, or standard input, to standard output.";
static LONG_HELP: &'static str = "
static LONG_HELP: &str = "
With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base32 alphabet in RFC

View file

@ -17,10 +17,10 @@ use std::fs::File;
use std::io::{stdin, BufReader, Read};
use std::path::Path;
static SYNTAX: &'static str = "[OPTION]... [FILE]";
static SUMMARY: &'static str =
static SYNTAX: &str = "[OPTION]... [FILE]";
static SUMMARY: &str =
"Base64 encode or decode FILE, or standard input, to standard output.";
static LONG_HELP: &'static str = "
static LONG_HELP: &str = "
With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base64 alphabet in RFC

View file

@ -14,11 +14,11 @@ extern crate uucore;
use std::path::{is_separator, PathBuf};
static NAME: &'static str = "basename";
static SYNTAX: &'static str = "NAME [SUFFIX]";
static SUMMARY: &'static str = "Print NAME with any leading directory components removed
static NAME: &str = "basename";
static SYNTAX: &str = "NAME [SUFFIX]";
static SUMMARY: &str = "Print NAME with any leading directory components removed
If specified, also remove a trailing SUFFIX";
static LONG_HELP: &'static str = "";
static LONG_HELP: &str = "";
pub fn uumain(args: Vec<String>) -> i32 {
//

View file

@ -31,10 +31,10 @@ use std::os::unix::fs::FileTypeExt;
#[cfg(unix)]
use unix_socket::UnixStream;
static SYNTAX: &'static str = "[OPTION]... [FILE]...";
static SUMMARY: &'static str = "Concatenate FILE(s), or standard input, to standard output
static SYNTAX: &str = "[OPTION]... [FILE]...";
static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output
With no FILE, or when FILE is -, read standard input.";
static LONG_HELP: &'static str = "";
static LONG_HELP: &str = "";
#[derive(PartialEq)]
enum NumberingMode {

View file

@ -29,9 +29,9 @@ use std::path::Path;
use std::ffi::CString;
use std::os::unix::ffi::OsStrExt;
static SYNTAX: &'static str =
static SYNTAX: &str =
"chgrp [OPTION]... GROUP FILE...\n or : chgrp [OPTION]... --reference=RFILE FILE...";
static SUMMARY: &'static str = "Change the group of each FILE to GROUP.";
static SUMMARY: &str = "Change the group of each FILE to GROUP.";
const FTS_COMFOLLOW: u8 = 1;
const FTS_PHYSICAL: u8 = 1 << 1;

View file

@ -30,9 +30,9 @@ use std::convert::AsRef;
use std::ffi::CString;
use std::os::unix::ffi::OsStrExt;
static SYNTAX: &'static str =
static SYNTAX: &str =
"[OPTION]... [OWNER][:[GROUP]] FILE...\n chown [OPTION]... --reference=RFILE FILE...";
static SUMMARY: &'static str = "change file owner and group";
static SUMMARY: &str = "change file owner and group";
const FTS_COMFOLLOW: u8 = 1;
const FTS_PHYSICAL: u8 = 1 << 1;

View file

@ -23,10 +23,10 @@ use std::iter::FromIterator;
use std::path::Path;
use std::process::Command;
static NAME: &'static str = "chroot";
static SYNTAX: &'static str = "[OPTION]... NEWROOT [COMMAND [ARG]...]";
static SUMMARY: &'static str = "Run COMMAND with root directory set to NEWROOT.";
static LONG_HELP: &'static str = "
static NAME: &str = "chroot";
static SYNTAX: &str = "[OPTION]... NEWROOT [COMMAND [ARG]...]";
static SUMMARY: &str = "Run COMMAND with root directory set to NEWROOT.";
static LONG_HELP: &str = "
If COMMAND is not specified, it defaults to '$(SHELL) -i'.
If $(SHELL) is not set, /bin/sh is used.
";

View file

@ -13,7 +13,7 @@ use std::fs::File;
use std::io::Write;
use std::path::Path;
static CRC_TABLE_LEN: usize = 256;
const CRC_TABLE_LEN: usize = 256;
#[path = "../../mkmain.rs"]
mod mkmain;

View file

@ -14,10 +14,10 @@ extern crate uucore;
use std::path::Path;
static NAME: &'static str = "dirname";
static SYNTAX: &'static str = "[OPTION] NAME...";
static SUMMARY: &'static str = "strip last component from file name";
static LONG_HELP: &'static str = "
static NAME: &str = "dirname";
static SYNTAX: &str = "[OPTION] NAME...";
static SUMMARY: &str = "strip last component from file name";
static LONG_HELP: &str = "
Output each NAME with its last non-slash component and trailing slashes
removed; if NAME contains no /'s, output '.' (meaning the current
directory).

8
src/env/env.rs vendored
View file

@ -17,10 +17,10 @@ use std::env;
use std::io::{stdout, Write};
use std::process::Command;
static NAME: &'static str = "env";
static SYNTAX: &'static str = "[OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]";
static SUMMARY: &'static str = "Set each NAME to VALUE in the environment and run COMMAND";
static LONG_HELP: &'static str = "
static NAME: &str = "env";
static SYNTAX: &str = "[OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]";
static SUMMARY: &str = "Set each NAME to VALUE in the environment and run COMMAND";
static LONG_HELP: &str = "
A mere - implies -i. If no COMMAND, print the resulting environment
";

View file

@ -23,10 +23,10 @@ use std::iter::repeat;
use std::str::from_utf8;
use unicode_width::UnicodeWidthChar;
static SYNTAX: &'static str = "[OPTION]... [FILE]...";
static SUMMARY: &'static str = "Convert tabs in each FILE to spaces, writing to standard output.
static SYNTAX: &str = "[OPTION]... [FILE]...";
static SUMMARY: &str = "Convert tabs in each FILE to spaces, writing to standard output.
With no FILE, or when FILE is -, read standard input.";
static LONG_HELP: &'static str = "";
static LONG_HELP: &str = "";
static DEFAULT_TABSTOP: usize = 8;

View file

@ -29,10 +29,10 @@ mod numeric;
include!(concat!(env!("OUT_DIR"), "/prime_table.rs"));
static SYNTAX: &'static str = "[OPTION] [NUMBER]...";
static SUMMARY: &'static str = "Print the prime factors of the given number(s).
static SYNTAX: &str = "[OPTION] [NUMBER]...";
static SUMMARY: &str = "Print the prime factors of the given number(s).
If none are specified, read from standard input.";
static LONG_HELP: &'static str = "";
static LONG_HELP: &str = "";
fn rho_pollard_pseudorandom_function(x: u64, a: u64, b: u64, num: u64) -> u64 {
if num < 1 << 63 {
@ -148,7 +148,7 @@ fn print_factors(num: u64) {
for fac in &factors {
print!(" {}", fac);
}
println!("");
println!();
}
fn print_factors_str(num_str: &str) {

View file

@ -34,9 +34,9 @@ mod linebreak;
mod parasplit;
// program's NAME and VERSION are used for -V and -h
static SYNTAX: &'static str = "[OPTION]... [FILE]...";
static SUMMARY: &'static str = "Reformat paragraphs from input files (or stdin) to stdout.";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "[OPTION]... [FILE]...";
static SUMMARY: &str = "Reformat paragraphs from input files (or stdin) to stdout.";
static LONG_HELP: &str = "";
pub type FileOrStdReader = BufReader<Box<Read + 'static>>;
pub struct FmtOptions {
@ -120,62 +120,47 @@ pub fn uumain(args: Vec<String>) -> i32 {
fmt_opts.xanti_prefix = true;
}
match matches.opt_str("p") {
Some(s) => {
fmt_opts.prefix = s;
fmt_opts.use_prefix = true;
}
None => (),
if let Some(s) = matches.opt_str("p") {
fmt_opts.prefix = s;
fmt_opts.use_prefix = true;
};
match matches.opt_str("P") {
Some(s) => {
fmt_opts.anti_prefix = s;
fmt_opts.use_anti_prefix = true;
}
None => (),
if let Some(s) = matches.opt_str("P") {
fmt_opts.anti_prefix = s;
fmt_opts.use_anti_prefix = true;
};
match matches.opt_str("w") {
Some(s) => {
fmt_opts.width = match s.parse::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid WIDTH specification: `{}': {}", s, e);
}
};
fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3);
}
None => (),
};
match matches.opt_str("g") {
Some(s) => {
fmt_opts.goal = match s.parse::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid GOAL specification: `{}': {}", s, e);
}
};
if !matches.opt_present("w") {
fmt_opts.width = cmp::max(fmt_opts.goal * 100 / 94, fmt_opts.goal + 3);
} else if fmt_opts.goal > fmt_opts.width {
crash!(1, "GOAL cannot be greater than WIDTH.");
if let Some(s) = matches.opt_str("w") {
fmt_opts.width = match s.parse::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid WIDTH specification: `{}': {}", s, e);
}
}
None => (),
};
fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3);
};
match matches.opt_str("T") {
Some(s) => {
fmt_opts.tabwidth = match s.parse::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid TABWIDTH specification: `{}': {}", s, e);
}
};
if let Some(s) = matches.opt_str("g") {
fmt_opts.goal = match s.parse::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid GOAL specification: `{}': {}", s, e);
}
};
if !matches.opt_present("w") {
fmt_opts.width = cmp::max(fmt_opts.goal * 100 / 94, fmt_opts.goal + 3);
} else if fmt_opts.goal > fmt_opts.width {
crash!(1, "GOAL cannot be greater than WIDTH.");
}
None => (),
};
if let Some(s) = matches.opt_str("T") {
fmt_opts.tabwidth = match s.parse::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid TABWIDTH specification: `{}': {}", s, e);
}
};
};
if fmt_opts.tabwidth < 1 {
@ -208,7 +193,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
match para_result {
Err(s) => {
silent_unwrap!(ostream.write_all(s.as_bytes()));
silent_unwrap!(ostream.write_all("\n".as_bytes()));
silent_unwrap!(ostream.write_all(b"\n"));
}
Ok(para) => break_lines(&para, &fmt_opts, &mut ostream),
}

View file

@ -53,7 +53,7 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter<
let (w, w_len) = match p_words_words.next() {
Some(winfo) => (winfo.word, winfo.word_nchars),
None => {
silent_unwrap!(ostream.write_all("\n".as_bytes()));
silent_unwrap!(ostream.write_all(b"\n"));
return;
}
};
@ -77,12 +77,12 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter<
let uniform = para.mail_header || opts.uniform;
let mut break_args = BreakArgs {
opts: opts,
opts,
init_len: p_init_len,
indent_str: &p_indent[..],
indent_len: p_indent_len,
uniform: uniform,
ostream: ostream,
uniform,
ostream,
};
if opts.quick || para.mail_header {
@ -98,7 +98,7 @@ fn break_simple<'a, T: Iterator<Item = &'a WordInfo<'a>>>(iter: T, args: &mut Br
iter.fold((args.init_len, false), |l, winfo| {
accum_words_simple(args, l, winfo)
});
silent_unwrap!(args.ostream.write_all("\n".as_bytes()));
silent_unwrap!(args.ostream.write_all(b"\n"));
}
fn accum_words_simple<'a>(
@ -199,7 +199,7 @@ fn break_knuth_plass<'a, T: Clone + Iterator<Item = &'a WordInfo<'a>>>(
fresh = false;
write_with_spaces(word, slen, args.ostream);
}
silent_unwrap!(args.ostream.write_all("\n".as_bytes()));
silent_unwrap!(args.ostream.write_all(b"\n"));
}
struct LineBreak<'a> {
@ -381,7 +381,7 @@ fn build_best_path<'a>(paths: &[LineBreak<'a>], active: &[usize]) -> Vec<(&'a Wo
}
// "infinite" badness is more like (1+BAD_INFTY)^2 because of how demerits are computed
const BAD_INFTY: i64 = 10000000;
const BAD_INFTY: i64 = 10_000_000;
const BAD_INFTY_SQ: i64 = BAD_INFTY * BAD_INFTY;
// badness = BAD_MULT * abs(r) ^ 3
const BAD_MULT: f32 = 100.0;
@ -451,7 +451,7 @@ fn restart_active_breaks<'a>(
LineBreak {
prev: act_idx,
linebreak: Some(w),
break_before: break_before,
break_before,
demerits: 0, // this is the only active break, so we can reset the demerit count
prev_rat: if break_before { 1.0 } else { -1.0 },
length: line_length,
@ -492,16 +492,16 @@ fn slice_if_fresh(
// Write a newline and add the indent.
fn write_newline(indent: &str, ostream: &mut BufWriter<Stdout>) {
silent_unwrap!(ostream.write_all("\n".as_bytes()));
silent_unwrap!(ostream.write_all(b"\n"));
silent_unwrap!(ostream.write_all(indent.as_bytes()));
}
// Write the word, along with slen spaces.
fn write_with_spaces(word: &str, slen: usize, ostream: &mut BufWriter<Stdout>) {
if slen == 2 {
silent_unwrap!(ostream.write_all(" ".as_bytes()));
silent_unwrap!(ostream.write_all(b" "));
} else if slen == 1 {
silent_unwrap!(ostream.write_all(" ".as_bytes()));
silent_unwrap!(ostream.write_all(b" "));
}
silent_unwrap!(ostream.write_all(word.as_bytes()));
}

View file

@ -73,8 +73,8 @@ pub struct FileLines<'a> {
impl<'a> FileLines<'a> {
fn new<'b>(opts: &'b FmtOptions, lines: Lines<&'b mut FileOrStdReader>) -> FileLines<'b> {
FileLines {
opts: opts,
lines: lines,
opts,
lines,
}
}
@ -197,10 +197,10 @@ impl<'a> Iterator for FileLines<'a> {
Some(Line::FormatLine(FileLine {
line: n,
indent_end: indent_end,
indent_end,
pfxind_end: poffset,
indent_len: indent_len,
prefix_len: prefix_len,
indent_len,
prefix_len,
}))
}
}
@ -234,9 +234,9 @@ impl<'a> ParagraphStream<'a> {
let lines = FileLines::new(opts, reader.lines()).peekable();
// at the beginning of the file, we might find mail headers
ParagraphStream {
lines: lines,
lines,
next_mail: true,
opts: opts,
opts,
}
}
@ -405,12 +405,12 @@ impl<'a> Iterator for ParagraphStream<'a> {
Some(Ok(Paragraph {
lines: p_lines,
init_str: init_str,
init_len: init_len,
init_end: init_end,
indent_str: indent_str,
indent_len: indent_len,
indent_end: indent_end,
init_str,
init_len,
init_end,
indent_str,
indent_len,
indent_end,
mail_header: in_mail,
}))
}
@ -425,8 +425,8 @@ pub struct ParaWords<'a> {
impl<'a> ParaWords<'a> {
pub fn new<'b>(opts: &'b FmtOptions, para: &'b Paragraph) -> ParaWords<'b> {
let mut pw = ParaWords {
opts: opts,
para: para,
opts,
para,
words: Vec::new(),
};
pw.create_words();
@ -522,7 +522,7 @@ impl<'a> WordSplit<'a> {
// wordsplits *must* start at a non-whitespace character
let trim_string = string.trim_left();
WordSplit {
opts: opts,
opts,
string: trim_string,
length: string.len(),
position: 0,
@ -610,14 +610,14 @@ impl<'a> Iterator for WordSplit<'a> {
};
Some(WordInfo {
word: word,
word,
word_start: word_start_relative,
word_nchars: word_nchars,
before_tab: before_tab,
after_tab: after_tab,
word_nchars,
before_tab,
after_tab,
sentence_start: is_start_of_sentence,
ends_punct: self.prev_punct,
new_line: new_line,
new_line,
})
}
}

View file

@ -16,10 +16,10 @@ use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
use std::path::Path;
static SYNTAX: &'static str = "[OPTION]... [FILE]...";
static SUMMARY: &'static str = "Writes each file (or standard input if no files are given)
static SYNTAX: &str = "[OPTION]... [FILE]...";
static SUMMARY: &str = "Writes each file (or standard input if no files are given)
to standard output whilst breaking long lines";
static LONG_HELP: &'static str = "";
static LONG_HELP: &str = "";
pub fn uumain(args: Vec<String>) -> i32 {
let (args, obs_width) = handle_obsolete(&args[..]);
@ -70,7 +70,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {
for (i, arg) in args.iter().enumerate() {
let slice = &arg;
if slice.chars().next().unwrap() == '-' && slice.len() > 1
if slice.starts_with('-') && slice.len() > 1
&& slice.chars().nth(1).unwrap().is_digit(10)
{
let mut v = args.to_vec();
@ -123,10 +123,10 @@ fn fold_file<T: Read>(mut file: BufReader<T>, bytes: bool, spaces: bool, width:
}
} else {
let mut len = line.chars().count();
let newline = line.ends_with("\n");
let newline = line.ends_with('\n');
if newline {
if len == 1 {
println!("");
println!();
continue;
}
len -= 1;

View file

@ -14,8 +14,8 @@
extern crate uucore;
use uucore::entries::{get_groups, Locate, Passwd, gid2grp};
static SYNTAX: &'static str = "[user]";
static SUMMARY: &'static str = "display current group names";
static SYNTAX: &str = "[user]";
static SUMMARY: &str = "display current group names";
pub fn uumain(args: Vec<String>) -> i32 {
let matches = new_coreopts!(SYNTAX, SUMMARY, "").parse(args);
@ -30,19 +30,17 @@ pub fn uumain(args: Vec<String>) -> i32 {
.collect::<Vec<_>>()
.join(" ")
);
} else if let Ok(p) = Passwd::locate(matches.free[0].as_str()) {
println!(
"{}",
p.belongs_to()
.iter()
.map(|&g| gid2grp(g).unwrap())
.collect::<Vec<_>>()
.join(" ")
);
} else {
if let Ok(p) = Passwd::locate(matches.free[0].as_str()) {
println!(
"{}",
p.belongs_to()
.iter()
.map(|&g| gid2grp(g).unwrap())
.collect::<Vec<_>>()
.join(" ")
);
} else {
crash!(1, "unknown user {}", matches.free[0]);
}
crash!(1, "unknown user {}", matches.free[0]);
}
0

View file

@ -38,8 +38,8 @@ use std::fs::File;
use std::io::{self, stdin, BufRead, BufReader, Read};
use std::path::Path;
static NAME: &'static str = "hashsum";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "hashsum";
static VERSION: &str = env!("CARGO_PKG_VERSION");
fn is_custom_binary(program: &str) -> bool {
match program {
@ -493,8 +493,8 @@ fn digest_reader<'a, T: Read>(
// Digest file, do not hold too much in memory at any given moment
let windows = cfg!(windows);
let mut buffer = Vec::with_capacity(524288);
let mut vec = Vec::with_capacity(524288);
let mut buffer = Vec::with_capacity(524_288);
let mut vec = Vec::with_capacity(524_288);
let mut looking_for_newline = false;
loop {
match reader.read_to_end(&mut buffer) {
@ -504,17 +504,17 @@ fn digest_reader<'a, T: Read>(
Ok(nread) => {
if windows && !binary {
// Windows text mode returns '\n' when reading '\r\n'
for i in 0..nread {
for &b in buffer.iter().take(nread) {
if looking_for_newline {
if buffer[i] != ('\n' as u8) {
vec.push('\r' as u8);
if b != b'\n' {
vec.push(b'\r');
}
if buffer[i] != ('\r' as u8) {
vec.push(buffer[i]);
if b != b'\r' {
vec.push(b);
looking_for_newline = false;
}
} else if buffer[i] != ('\r' as u8) {
vec.push(buffer[i]);
} else if b != b'\r' {
vec.push(b);
} else {
looking_for_newline = true;
}
@ -529,7 +529,7 @@ fn digest_reader<'a, T: Read>(
}
}
if windows && looking_for_newline {
vec.push('\r' as u8);
vec.push(b'\r');
digest.input(&vec);
}

View file

@ -19,9 +19,9 @@ use std::fs::File;
use std::path::Path;
use std::str::from_utf8;
static SYNTAX: &'static str = "";
static SUMMARY: &'static str = "";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "";
static SUMMARY: &str = "";
static LONG_HELP: &str = "";
enum FilterMode {
Bytes(usize),
@ -90,16 +90,15 @@ pub fn uumain(args: Vec<String>) -> i32 {
}
}
}
None => match matches.opt_str("c") {
Some(count) => match count.parse::<usize>() {
None => if let Some(count) = matches.opt_str("c") {
match count.parse::<usize>() {
Ok(m) => settings.mode = FilterMode::Bytes(m),
Err(e) => {
show_error!("invalid byte count '{}': {}", count, e);
return 1;
}
},
None => {}
},
}
}
};
let quiet = matches.opt_present("q");
@ -129,7 +128,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
for file in &files {
if settings.verbose {
if !firstime {
println!("");
println!();
}
println!("==> {} <==", file);
}
@ -160,7 +159,7 @@ fn obsolete(options: &[String]) -> (Vec<String>, Option<usize>) {
let current = options[a].clone();
let current = current.as_bytes();
if current.len() > 1 && current[0] == '-' as u8 {
if current.len() > 1 && current[0] == b'-' {
let len = current.len();
for pos in 1..len {
// Ensure that the argument is only made out of digits

View file

@ -16,9 +16,9 @@ extern crate uucore;
use libc::c_long;
static SYNTAX: &'static str = "[options]";
static SUMMARY: &'static str = "";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "[options]";
static SUMMARY: &str = "";
static LONG_HELP: &str = "";
pub enum Mode {
HostId,
@ -49,6 +49,6 @@ fn hostid() {
result = gethostid();
}
result &= 0xffffffff;
result &= 0xffff_ffff;
println!("{:0>8x}", result);
}

View file

@ -38,9 +38,9 @@ use libc::gethostname;
#[cfg(not(windows))]
use libc::sethostname;
const SYNTAX: &'static str = "[OPTION]... [HOSTNAME]";
const SUMMARY: &'static str = "Print or set the system's host name.";
const LONG_HELP: &'static str = "";
const SYNTAX: &str = "[OPTION]... [HOSTNAME]";
const SUMMARY: &str = "Print or set the system's host name.";
const LONG_HELP: &str = "";
pub fn uumain(args: Vec<String>) -> i32 {
#[cfg(windows)]

View file

@ -21,10 +21,10 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::result::Result;
static NAME: &'static str = "install";
static SUMMARY: &'static str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing
static NAME: &str = "install";
static SUMMARY: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing
DIRECTORY, while setting permission modes and owner/group";
static LONG_HELP: &'static str = "";
static LONG_HELP: &str = "";
const DEFAULT_MODE: u32 = 755;

View file

@ -19,8 +19,8 @@ use std::io::{stdin, BufRead, BufReader, Lines, Stdin};
use std::cmp::{min, Ordering};
use clap::{App, Arg};
static NAME: &'static str = "join";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "join";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Copy, Clone, PartialEq)]
enum FileNum {

View file

@ -18,9 +18,9 @@ use libc::{c_int, pid_t};
use std::io::Error;
use uucore::signals::ALL_SIGNALS;
static SYNTAX: &'static str = "[options] <pid> [...]";
static SUMMARY: &'static str = "";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "[options] <pid> [...]";
static SUMMARY: &str = "";
static LONG_HELP: &str = "";
static EXIT_OK: i32 = 0;
static EXIT_ERR: i32 = 1;

View file

@ -16,9 +16,9 @@ use std::fs::hard_link;
use std::path::Path;
use std::io::Error;
static SYNTAX: &'static str = "[OPTIONS] FILE1 FILE2";
static SUMMARY: &'static str = "Create a link named FILE2 to FILE1";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "[OPTIONS] FILE1 FILE2";
static SUMMARY: &str = "Create a link named FILE2 to FILE1";
static LONG_HELP: &str = "";
pub fn normalize_error_message(e: Error) -> String {
match e.raw_os_error() {

View file

@ -20,9 +20,9 @@ use std::os::unix::fs::symlink;
use std::os::windows::fs::{symlink_dir, symlink_file};
use std::path::{Path, PathBuf};
static NAME: &'static str = "ln";
static SUMMARY: &'static str = "";
static LONG_HELP: &'static str = "
static NAME: &str = "ln";
static SUMMARY: &str = "";
static LONG_HELP: &str = "
In the 1st form, create a link to TARGET with the name LINK_NAME.
In the 2nd form, create a link to TARGET in the current directory.
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.

View file

@ -34,9 +34,9 @@ fn get_userlogin() -> Option<String> {
}
}
static SYNTAX: &'static str = "";
static SUMMARY: &'static str = "Print user's login name";
static LONG_HELP: &'static str = "";
static SYNTAX: &str = "";
static SUMMARY: &str = "Print user's login name";
static LONG_HELP: &str = "";
pub fn uumain(args: Vec<String>) -> i32 {
new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);

View file

@ -44,16 +44,16 @@ use unicode_width::UnicodeWidthStr;
#[cfg(windows)]
use std::os::windows::fs::MetadataExt;
static NAME: &'static str = "ls";
static SUMMARY: &'static str = "";
static LONG_HELP: &'static str = "
static NAME: &str = "ls";
static SUMMARY: &str = "";
static LONG_HELP: &str = "
By default, ls will list the files and contents of any directories on
the command line, expect that it will ignore files and directories
whose names start with '.'
";
#[cfg(unix)]
static DEFAULT_COLORS: &'static str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:";
static DEFAULT_COLORS: &str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:";
#[cfg(unix)]
lazy_static! {

View file

@ -18,8 +18,8 @@ extern crate uucore;
use std::fs;
use std::path::{Path, PathBuf};
static NAME: &'static str = "mkdir";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "mkdir";
static VERSION: &str = env!("CARGO_PKG_VERSION");
/**
* Handles option parsing

View file

@ -19,8 +19,8 @@ use libc::mkfifo;
use std::ffi::CString;
use std::io::Error;
static NAME: &'static str = "mkfifo";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "mkfifo";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -23,8 +23,8 @@ use getopts::Options;
use std::ffi::CString;
static NAME: &'static str = "mknod";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "mknod";
static VERSION: &str = env!("CARGO_PKG_VERSION");
const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;

View file

@ -26,9 +26,9 @@ use tempfile::NamedTempFileOptions;
mod tempdir;
static NAME: &'static str = "mktemp";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static DEFAULT_TEMPLATE: &'static str = "tmp.XXXXXXXXXX";
static NAME: &str = "mktemp";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX";
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -35,8 +35,8 @@ pub enum Mode {
Version,
}
static NAME: &'static str = "more";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "more";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = Options::new();

View file

@ -19,8 +19,8 @@ use std::env;
use std::io::{stdin, BufRead, BufReader, Result};
use std::path::{Path, PathBuf};
static NAME: &'static str = "mv";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "mv";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub struct Behaviour {
overwrite: OverwriteMode,

View file

@ -19,8 +19,8 @@ use libc::{c_char, c_int, execvp};
use std::ffi::CString;
use std::io::Error;
const NAME: &'static str = "nice";
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const NAME: &str = "nice";
const VERSION: &str = env!("CARGO_PKG_VERSION");
// XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X.
const PRIO_PROCESS: c_int = 0;

View file

@ -26,9 +26,9 @@ use std::path::Path;
mod helper;
static NAME: &'static str = "nl";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static USAGE: &'static str = "nl [OPTION]... [FILE]...";
static NAME: &str = "nl";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static USAGE: &str = "nl [OPTION]... [FILE]...";
// A regular expression matching everything.
// Settings store options used by nl to produce its output.

View file

@ -25,8 +25,8 @@ use std::path::{Path, PathBuf};
use std::env;
use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive};
static NAME: &'static str = "nohup";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "nohup";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(target_os = "macos")]
extern "C" {

View file

@ -29,8 +29,8 @@ pub const _SC_NPROCESSORS_CONF: libc::c_int = 57;
#[cfg(target_os = "netbsd")]
pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001;
static NAME: &'static str = "nproc";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "nproc";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -15,8 +15,8 @@ use getopts::{Matches, Options};
use std::io::BufRead;
use std::fmt;
static NAME: &'static str = "numfmt";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "numfmt";
static VERSION: &str = env!("CARGO_PKG_VERSION");
type Result<T> = std::result::Result<T, String>;

View file

@ -47,10 +47,10 @@ use inputoffset::{InputOffset, Radix};
use inputdecoder::{InputDecoder, MemoryDecoder};
use output_info::OutputInfo;
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static VERSION: &str = env!("CARGO_PKG_VERSION");
const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes
static USAGE: &'static str = r#"Usage:
static USAGE: &str = r#"Usage:
od [OPTION]... [--] [FILENAME]...
od [-abcdDefFhHiIlLoOsxX] [FILENAME] [[+][0x]OFFSET[.][b]]
od --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]]

View file

@ -13,7 +13,7 @@ pub static FORMAT_ITEM_C: FormatterItemInfo = FormatterItemInfo {
formatter: FormatWriter::MultibyteWriter(format_item_c),
};
static A_CHRS: [&'static str; 128] = [
static A_CHRS: [&str; 128] = [
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "ff", "cr",
"so", "si", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc",
"fs", "gs", "rs", "us", "sp", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",

View file

@ -19,8 +19,8 @@ use std::iter::repeat;
use std::fs::File;
use std::path::Path;
static NAME: &'static str = "paste";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "paste";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -30,12 +30,12 @@ enum Mode {
Version, // show version information
}
static NAME: &'static str = "pathchk";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "pathchk";
static VERSION: &str = env!("CARGO_PKG_VERSION");
// a few global constants as used in the GNU implementation
static POSIX_PATH_MAX: usize = 256;
static POSIX_NAME_MAX: usize = 14;
const POSIX_PATH_MAX: usize = 256;
const POSIX_NAME_MAX: usize = 14;
pub fn uumain(args: Vec<String>) -> i32 {
// add options

View file

@ -24,8 +24,8 @@ use std::os::unix::fs::MetadataExt;
use std::path::PathBuf;
static SYNTAX: &'static str = "[OPTION]... [USER]...";
static SUMMARY: &'static str = "A lightweight 'finger' program; print user information.";
static SYNTAX: &str = "[OPTION]... [USER]...";
static SUMMARY: &str = "A lightweight 'finger' program; print user information.";
const BUFSIZE: usize = 1024;

View file

@ -18,8 +18,8 @@ extern crate uucore;
use std::env;
static NAME: &'static str = "printenv";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "printenv";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -4,8 +4,8 @@
use std::io::{stderr, stdout, Write};
use std::env;
pub static EXIT_OK: i32 = 0;
pub static EXIT_ERR: i32 = 1;
pub const EXIT_OK: i32 = 0;
pub const EXIT_ERR: i32 = 1;
pub fn err_msg(msg: &str) {
let exe_path = match env::current_exe() {

View file

@ -8,10 +8,10 @@ mod cli;
mod memo;
mod tokenize;
static NAME: &'static str = "printf";
static VERSION: &'static str = "0.0.1";
static SHORT_USAGE: &'static str = "printf: usage: printf [-v var] format [arguments]";
static LONGHELP_LEAD: &'static str = "printf
static NAME: &str = "printf";
static VERSION: &str = "0.0.1";
static SHORT_USAGE: &str = "printf: usage: printf [-v var] format [arguments]";
static LONGHELP_LEAD: &str = "printf
USAGE: printf FORMATSTRING [ARGUMENT]...
@ -26,7 +26,7 @@ Options:
--version output version information and exit
";
static LONGHELP_BODY: &'static str = "
static LONGHELP_BODY: &str = "
Prints the , replacing escaped character sequences with character literals
and substitution field sequences with passed arguments

View file

@ -26,8 +26,8 @@ use std::default::Default;
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
static NAME: &'static str = "ptx";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "ptx";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Debug)]
enum OutFormat {

View file

@ -18,8 +18,8 @@ use std::env;
use std::path::{Path, PathBuf};
use std::io;
static NAME: &'static str = "pwd";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "pwd";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn absolute_path(path: &Path) -> io::Result<PathBuf> {
let path_buf = path.canonicalize()?;

View file

@ -19,8 +19,8 @@ use std::io::{stdout, Write};
use std::path::PathBuf;
use uucore::fs::{canonicalize, CanonicalizeMode};
const NAME: &'static str = "readlink";
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const NAME: &str = "readlink";
const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -18,8 +18,8 @@ use std::fs;
use std::path::{Path, PathBuf};
use uucore::fs::{canonicalize, CanonicalizeMode};
static NAME: &'static str = "realpath";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "realpath";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -18,8 +18,8 @@ use std::env;
use std::path::{Path, PathBuf};
use uucore::fs::{canonicalize, CanonicalizeMode};
static NAME: &'static str = "relpath";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "relpath";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -42,8 +42,8 @@ struct Options {
verbose: bool,
}
static NAME: &'static str = "rm";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "rm";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
// TODO: make getopts support -R in addition to -r

View file

@ -17,8 +17,8 @@ extern crate uucore;
use std::fs;
use std::path::Path;
static NAME: &'static str = "rmdir";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "rmdir";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -11,8 +11,8 @@ extern crate uucore;
use std::cmp;
use std::io::{stdout, Write};
static NAME: &'static str = "seq";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "seq";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Clone)]
struct SeqOptions {

View file

@ -25,10 +25,10 @@ use std::path::{Path, PathBuf};
#[macro_use]
extern crate uucore;
static NAME: &'static str = "shred";
static VERSION_STR: &'static str = "1.0.0";
static NAME: &str = "shred";
static VERSION_STR: &str = "1.0.0";
const BLOCK_SIZE: usize = 512;
const NAMESET: &'static str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
const NAMESET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
// Patterns as shown in the GNU coreutils shred implementation
const PATTERNS: [&'static [u8]; 22] = [

View file

@ -26,8 +26,8 @@ enum Mode {
InputRange((usize, usize)),
}
static NAME: &'static str = "shuf";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "shuf";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -17,8 +17,8 @@ extern crate uucore;
use std::thread;
use std::time::Duration;
static NAME: &'static str = "sleep";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "sleep";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -26,11 +26,11 @@ use uucore::fs::is_stdin_interactive;
use semver::Version;
use itertools::Itertools; // for Iterator::dedup()
static NAME: &'static str = "sort";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "sort";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static DECIMAL_PT: char = '.';
static THOUSANDS_SEP: char = ',';
const DECIMAL_PT: char = '.';
const THOUSANDS_SEP: char = ',';
enum SortMode {
Numeric,

View file

@ -19,8 +19,8 @@ use std::fs::{File, OpenOptions};
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::path::Path;
static NAME: &'static str = "split";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "split";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -7,12 +7,12 @@ mod mkmain;
#[cfg(target_os = "linux")]
mod platform {
pub const DYLIB_EXT: &'static str = ".so";
pub const DYLIB_EXT: &str = ".so";
}
#[cfg(target_os = "macos")]
mod platform {
pub const DYLIB_EXT: &'static str = ".dylib";
pub const DYLIB_EXT: &str = ".dylib";
}
fn main() {

View file

@ -23,10 +23,10 @@ use std::os::unix::process::ExitStatusExt;
use std::path::PathBuf;
use std::process::Command;
static NAME: &'static str = "stdbuf";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "stdbuf";
static VERSION: &str = env!("CARGO_PKG_VERSION");
const STDBUF_INJECT: &'static [u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so"));
const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so"));
enum BufferType {
Default,

View file

@ -18,8 +18,8 @@ use std::fs::File;
use std::io::{stdin, Read, Result};
use std::path::Path;
static NAME: &'static str = "sum";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "sum";
static VERSION: &str = env!("CARGO_PKG_VERSION");
fn bsd_sum(mut reader: Box<Read>) -> (usize, u16) {
let mut buf = [0; 1024];

View file

@ -21,8 +21,8 @@ extern crate uucore;
#[cfg(not(windows))]
extern crate uucore;
static NAME: &'static str = "sync";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "sync";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(unix)]
mod platform {

View file

@ -17,8 +17,8 @@ extern crate uucore;
use std::fs::File;
use std::io::{stdin, stdout, BufReader, Read, Stdout, Write};
static NAME: &'static str = "tac";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "tac";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -29,8 +29,8 @@ use std::str::from_utf8;
use std::thread::sleep;
use std::time::Duration;
static NAME: &'static str = "tail";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "tail";
static VERSION: &str = env!("CARGO_PKG_VERSION");
enum FilterMode {
Bytes(u64),

View file

@ -17,8 +17,8 @@ use std::fs::OpenOptions;
use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write};
use std::path::{Path, PathBuf};
static NAME: &'static str = "tee";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "tee";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
match options(&args).and_then(exec) {

View file

@ -18,7 +18,7 @@ use std::ffi::OsString;
use std::env::args_os;
use std::str::from_utf8;
static NAME: &'static str = "test";
static NAME: &str = "test";
// TODO: decide how to handle non-UTF8 input for all the utils
// Definitely don't use [u8], try keeping it as OsStr or OsString instead

View file

@ -21,10 +21,10 @@ use std::process::{Command, Stdio};
use std::time::Duration;
use uucore::process::ChildExt;
static NAME: &'static str = "timeout";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "timeout";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ERR_EXIT_STATUS: i32 = 125;
const ERR_EXIT_STATUS: i32 = 125;
pub fn uumain(args: Vec<String>) -> i32 {
let program = args[0].clone();

View file

@ -21,8 +21,8 @@ use std::fs::{self, File};
use std::io::{self, Error};
use std::path::Path;
static NAME: &'static str = "touch";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "touch";
static VERSION: &str = env!("CARGO_PKG_VERSION");
// Since touch's date/timestamp parsing doesn't account for timezone, the
// returned value from time::strptime() is UTC. We get system's timezone to

View file

@ -28,8 +28,8 @@ use expand::ExpandSet;
mod expand;
static NAME: &'static str = "tr";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "tr";
static VERSION: &str = env!("CARGO_PKG_VERSION");
const BUFFER_LEN: usize = 1024;
trait SymbolTranslator {

View file

@ -31,8 +31,8 @@ enum TruncateMode {
RoundUp,
}
static NAME: &'static str = "truncate";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "truncate";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -20,8 +20,8 @@ use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
use std::path::Path;
static NAME: &'static str = "tsort";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "tsort";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -24,8 +24,8 @@ extern "C" {
fn ttyname(filedesc: libc::c_int) -> *const libc::c_char;
}
static NAME: &'static str = "tty";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "tty";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = getopts::Options::new();

View file

@ -19,35 +19,35 @@ extern crate uucore;
use clap::{App, Arg};
use platform_info::*;
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const ABOUT: &'static str = "Print certain system information. With no OPTION, same as -s.";
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ABOUT: &str = "Print certain system information. With no OPTION, same as -s.";
const OPT_ALL: &'static str = "all";
const OPT_KERNELNAME: &'static str = "kernel-name";
const OPT_NODENAME: &'static str = "nodename";
const OPT_KERNELVERSION: &'static str = "kernel-version";
const OPT_KERNELRELEASE: &'static str = "kernel-release";
const OPT_MACHINE: &'static str = "machine";
const OPT_ALL: &str = "all";
const OPT_KERNELNAME: &str = "kernel-name";
const OPT_NODENAME: &str = "nodename";
const OPT_KERNELVERSION: &str = "kernel-version";
const OPT_KERNELRELEASE: &str = "kernel-release";
const OPT_MACHINE: &str = "machine";
//FIXME: unimplemented options
//const OPT_PROCESSOR: &'static str = "processor";
//const OPT_HWPLATFORM: &'static str = "hardware-platform";
const OPT_OS: &'static str = "operating-system";
const OPT_OS: &str = "operating-system";
#[cfg(target_os = "linux")]
const HOST_OS: &'static str = "GNU/Linux";
const HOST_OS: &str = "GNU/Linux";
#[cfg(target_os = "windows")]
const HOST_OS: &'static str = "Windows NT";
const HOST_OS: &str = "Windows NT";
#[cfg(target_os = "freebsd")]
const HOST_OS: &'static str = "FreeBSD";
const HOST_OS: &str = "FreeBSD";
#[cfg(target_os = "openbsd")]
const HOST_OS: &'static str = "OpenBSD";
const HOST_OS: &str = "OpenBSD";
#[cfg(target_os = "macos")]
const HOST_OS: &'static str = "Darwin";
const HOST_OS: &str = "Darwin";
#[cfg(target_os = "fuchsia")]
const HOST_OS: &'static str = "Fuchsia";
const HOST_OS: &str = "Fuchsia";
#[cfg(target_os = "redox")]
const HOST_OS: &'static str = "Redox";
const HOST_OS: &str = "Redox";
pub fn uumain(args: Vec<String>) -> i32 {
let usage = format!("{} [OPTION]...", executable!());

View file

@ -22,10 +22,10 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write}
use std::str::from_utf8;
use unicode_width::UnicodeWidthChar;
static NAME: &'static str = "unexpand";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "unexpand";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static DEFAULT_TABSTOP: usize = 8;
const DEFAULT_TABSTOP: usize = 8;
fn tabstops_parse(s: String) -> Vec<usize> {
let words = s.split(',').collect::<Vec<&str>>();

View file

@ -21,8 +21,8 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::path::Path;
use std::str::FromStr;
static NAME: &'static str = "uniq";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "uniq";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(PartialEq)]
enum Delimiters {

View file

@ -24,8 +24,8 @@ use std::io::{Error, ErrorKind};
use std::mem::uninitialized;
use std::ffi::CString;
static NAME: &'static str = "unlink";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "unlink";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = Options::new();

View file

@ -23,8 +23,8 @@ pub use uucore::libc;
use getopts::Options;
static NAME: &'static str = "uptime";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "uptime";
static VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(unix)]
use libc::getloadavg;

View file

@ -21,8 +21,8 @@ use uucore::utmpx::*;
use getopts::Options;
static NAME: &'static str = "users";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "users";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = Options::new();

View file

@ -64,7 +64,7 @@ macro_rules! chars2string {
#[cfg(target_os = "linux")]
mod ut {
pub static DEFAULT_FILE: &'static str = "/var/run/utmp";
pub static DEFAULT_FILE: &str = "/var/run/utmp";
pub use libc::__UT_LINESIZE as UT_LINESIZE;
pub use libc::__UT_NAMESIZE as UT_NAMESIZE;
@ -85,7 +85,7 @@ mod ut {
#[cfg(target_os = "macos")]
mod ut {
pub static DEFAULT_FILE: &'static str = "/var/run/utmpx";
pub static DEFAULT_FILE: &str = "/var/run/utmpx";
pub use libc::_UTX_LINESIZE as UT_LINESIZE;
pub use libc::_UTX_USERSIZE as UT_NAMESIZE;
@ -110,7 +110,7 @@ mod ut {
mod ut {
use super::libc;
pub static DEFAULT_FILE: &'static str = "";
pub static DEFAULT_FILE: &str = "";
pub const UT_LINESIZE: usize = 16;
pub const UT_NAMESIZE: usize = 32;

View file

@ -18,8 +18,8 @@ use std::io::Write;
extern crate uucore;
static NAME: &'static str = "uutils";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "uutils";
static VERSION: &str = env!("CARGO_PKG_VERSION");
include!(concat!(env!("OUT_DIR"), "/uutils_map.rs"));

View file

@ -67,8 +67,8 @@ struct Result {
max_line_length: usize,
}
static NAME: &'static str = "wc";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
static NAME: &str = "wc";
static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = Options::new();

View file

@ -19,9 +19,9 @@ use std::ffi::CStr;
use std::path::PathBuf;
use std::os::unix::fs::MetadataExt;
static SYNTAX: &'static str = "[OPTION]... [ FILE | ARG1 ARG2 ]";
static SUMMARY: &'static str = "Print information about users who are currently logged in.";
static LONG_HELP: &'static str = "
static SYNTAX: &str = "[OPTION]... [ FILE | ARG1 ARG2 ]";
static SUMMARY: &str = "Print information about users who are currently logged in.";
static LONG_HELP: &str = "
-a, --all same as -b -d --login -p -r -t -T -u
-b, --boot time of last system boot
-d, --dead print dead processes

View file

@ -19,7 +19,7 @@ extern crate uucore;
mod platform;
// force a re-build whenever Cargo.toml changes
const _CARGO_TOML: &'static str = include_str!("Cargo.toml");
const _CARGO_TOML: &str = include_str!("Cargo.toml");
pub fn uumain(args: Vec<String>) -> i32 {
let app = app_from_crate!();