mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (needless_lifetimes)
This commit is contained in:
parent
8c97f0eebb
commit
2db6fb20c9
8 changed files with 14 additions and 14 deletions
|
@ -149,5 +149,5 @@ const PREAMBLE: &'static str = r##"/*
|
||||||
// Please do not edit by hand. Instead, modify and
|
// Please do not edit by hand. Instead, modify and
|
||||||
// re-run src/factor/gen_tables.rs.
|
// re-run src/factor/gen_tables.rs.
|
||||||
|
|
||||||
pub const P_INVS_U64: &'static [(u64, u64, u64)] = &[
|
pub const P_INVS_U64: &[(u64, u64, u64)] = &[
|
||||||
"##;
|
"##;
|
||||||
|
|
|
@ -67,8 +67,8 @@ mod audit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SYNTAX: &'static str = "[OPTION]... [USER]";
|
static SYNTAX: &str = "[OPTION]... [USER]";
|
||||||
static SUMMARY: &'static str = "Print user and group information for the specified USER,\n or (when USER omitted) for the current user.";
|
static SUMMARY: &str = "Print user and group information for the specified USER,\n or (when USER omitted) for the current user.";
|
||||||
|
|
||||||
pub fn uumain(args: Vec<String>) -> i32 {
|
pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let mut opts = new_coreopts!(SYNTAX, SUMMARY, "");
|
let mut opts = new_coreopts!(SYNTAX, SUMMARY, "");
|
||||||
|
|
|
@ -74,7 +74,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
let paths: Vec<PathBuf> = {
|
let paths: Vec<PathBuf> = {
|
||||||
fn string_to_path<'a>(s: &'a String) -> &'a Path {
|
fn string_to_path(s: &String) -> &Path {
|
||||||
Path::new(s)
|
Path::new(s)
|
||||||
};
|
};
|
||||||
let to_owned = |p: &Path| p.to_owned();
|
let to_owned = |p: &Path| p.to_owned();
|
||||||
|
|
|
@ -124,7 +124,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
let paths: Vec<PathBuf> = {
|
let paths: Vec<PathBuf> = {
|
||||||
fn strip_slashes<'a>(p: &'a Path) -> &'a Path {
|
fn strip_slashes(p: &Path) -> &Path {
|
||||||
p.components().as_path()
|
p.components().as_path()
|
||||||
}
|
}
|
||||||
let to_owned = |p: &Path| p.to_owned();
|
let to_owned = |p: &Path| p.to_owned();
|
||||||
|
|
|
@ -30,7 +30,7 @@ fn format_item_a(p: u64) -> String {
|
||||||
format!("{:>4}", A_CHRS.get(b as usize).unwrap_or(&"??"))
|
format!("{:>4}", A_CHRS.get(b as usize).unwrap_or(&"??"))
|
||||||
}
|
}
|
||||||
|
|
||||||
static C_CHRS: [&'static str; 128] = [
|
static C_CHRS: [&str; 128] = [
|
||||||
"\\0", "001", "002", "003", "004", "005", "006", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f",
|
"\\0", "001", "002", "003", "004", "005", "006", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f",
|
||||||
"\\r", "016", "017", "020", "021", "022", "023", "024", "025", "026", "027", "030", "031",
|
"\\r", "016", "017", "020", "021", "022", "023", "024", "025", "026", "027", "030", "031",
|
||||||
"032", "033", "034", "035", "036", "037", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")",
|
"032", "033", "034", "035", "036", "037", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")",
|
||||||
|
|
|
@ -41,12 +41,12 @@ pub struct DivOut<'a> {
|
||||||
pub remainder: Remainder<'a>,
|
pub remainder: Remainder<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn arrnum_int_div_step<'a>(
|
pub fn arrnum_int_div_step(
|
||||||
rem_in: Remainder<'a>,
|
rem_in: Remainder,
|
||||||
radix_in: u8,
|
radix_in: u8,
|
||||||
base_ten_int_divisor: u8,
|
base_ten_int_divisor: u8,
|
||||||
after_decimal: bool,
|
after_decimal: bool,
|
||||||
) -> DivOut<'a> {
|
) -> DivOut {
|
||||||
let mut rem_out = Remainder {
|
let mut rem_out = Remainder {
|
||||||
position: rem_in.position,
|
position: rem_in.position,
|
||||||
replace: Vec::new(),
|
replace: Vec::new(),
|
||||||
|
|
|
@ -31,7 +31,7 @@ const BLOCK_SIZE: usize = 512;
|
||||||
const NAMESET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
|
const NAMESET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
|
||||||
|
|
||||||
// Patterns as shown in the GNU coreutils shred implementation
|
// Patterns as shown in the GNU coreutils shred implementation
|
||||||
const PATTERNS: [&'static [u8]; 22] = [
|
const PATTERNS: [&[u8]; 22] = [
|
||||||
b"\x00",
|
b"\x00",
|
||||||
b"\xFF",
|
b"\xFF",
|
||||||
b"\x55",
|
b"\x55",
|
||||||
|
|
|
@ -85,10 +85,10 @@ macro_rules! print_adjusted {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NAME: &'static str = "stat";
|
static NAME: &str = "stat";
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
const MOUNT_INFO: &'static str = "/etc/mtab";
|
const MOUNT_INFO: &str = "/etc/mtab";
|
||||||
pub const F_ALTER: u8 = 1;
|
pub const F_ALTER: u8 = 1;
|
||||||
pub const F_ZERO: u8 = 1 << 1;
|
pub const F_ZERO: u8 = 1 << 1;
|
||||||
pub const F_LEFT: u8 = 1 << 2;
|
pub const F_LEFT: u8 = 1 << 2;
|
||||||
|
@ -183,7 +183,7 @@ impl ScanUtil for str {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn group_num<'a>(s: &'a str) -> Cow<'a, str> {
|
pub fn group_num(s: &str) -> Cow<str> {
|
||||||
assert!(s.chars().all(char::is_numeric));
|
assert!(s.chars().all(char::is_numeric));
|
||||||
if s.len() < 4 {
|
if s.len() < 4 {
|
||||||
return s.into();
|
return s.into();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue