From 2db6fb20c9f83274b0977cb26609d561ac70270c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 29 Dec 2019 13:04:07 -0600 Subject: [PATCH] refactor/polish ~ fix `cargo clippy` complaints (needless_lifetimes) --- src/factor/build.rs | 2 +- src/id/id.rs | 4 ++-- src/install/install.rs | 2 +- src/mv/mv.rs | 2 +- src/od/prn_char.rs | 2 +- .../tokenize/num_format/formatters/base_conv/mod.rs | 6 +++--- src/shred/shred.rs | 2 +- src/stat/stat.rs | 8 ++++---- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/factor/build.rs b/src/factor/build.rs index bfd60baba..202be08b0 100644 --- a/src/factor/build.rs +++ b/src/factor/build.rs @@ -149,5 +149,5 @@ const PREAMBLE: &'static str = r##"/* // Please do not edit by hand. Instead, modify and // re-run src/factor/gen_tables.rs. -pub const P_INVS_U64: &'static [(u64, u64, u64)] = &[ +pub const P_INVS_U64: &[(u64, u64, u64)] = &[ "##; diff --git a/src/id/id.rs b/src/id/id.rs index a0e59fc73..aface17fc 100644 --- a/src/id/id.rs +++ b/src/id/id.rs @@ -67,8 +67,8 @@ mod audit { } } -static SYNTAX: &'static 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 SYNTAX: &str = "[OPTION]... [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) -> i32 { let mut opts = new_coreopts!(SYNTAX, SUMMARY, ""); diff --git a/src/install/install.rs b/src/install/install.rs index 0ae97cf34..300475abd 100644 --- a/src/install/install.rs +++ b/src/install/install.rs @@ -74,7 +74,7 @@ pub fn uumain(args: Vec) -> i32 { }; let paths: Vec = { - fn string_to_path<'a>(s: &'a String) -> &'a Path { + fn string_to_path(s: &String) -> &Path { Path::new(s) }; let to_owned = |p: &Path| p.to_owned(); diff --git a/src/mv/mv.rs b/src/mv/mv.rs index bcfc963a7..91fa65039 100644 --- a/src/mv/mv.rs +++ b/src/mv/mv.rs @@ -124,7 +124,7 @@ pub fn uumain(args: Vec) -> i32 { }; let paths: Vec = { - fn strip_slashes<'a>(p: &'a Path) -> &'a Path { + fn strip_slashes(p: &Path) -> &Path { p.components().as_path() } let to_owned = |p: &Path| p.to_owned(); diff --git a/src/od/prn_char.rs b/src/od/prn_char.rs index 4caf068fa..58ad323ef 100644 --- a/src/od/prn_char.rs +++ b/src/od/prn_char.rs @@ -30,7 +30,7 @@ fn format_item_a(p: u64) -> String { 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", "\\r", "016", "017", "020", "021", "022", "023", "024", "025", "026", "027", "030", "031", "032", "033", "034", "035", "036", "037", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", diff --git a/src/printf/tokenize/num_format/formatters/base_conv/mod.rs b/src/printf/tokenize/num_format/formatters/base_conv/mod.rs index 69cd285ba..8ed22aad4 100644 --- a/src/printf/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/printf/tokenize/num_format/formatters/base_conv/mod.rs @@ -41,12 +41,12 @@ pub struct DivOut<'a> { pub remainder: Remainder<'a>, } -pub fn arrnum_int_div_step<'a>( - rem_in: Remainder<'a>, +pub fn arrnum_int_div_step( + rem_in: Remainder, radix_in: u8, base_ten_int_divisor: u8, after_decimal: bool, -) -> DivOut<'a> { +) -> DivOut { let mut rem_out = Remainder { position: rem_in.position, replace: Vec::new(), diff --git a/src/shred/shred.rs b/src/shred/shred.rs index 189c1c7a3..c53782f6f 100644 --- a/src/shred/shred.rs +++ b/src/shred/shred.rs @@ -31,7 +31,7 @@ const BLOCK_SIZE: usize = 512; const NAMESET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; // Patterns as shown in the GNU coreutils shred implementation -const PATTERNS: [&'static [u8]; 22] = [ +const PATTERNS: [&[u8]; 22] = [ b"\x00", b"\xFF", b"\x55", diff --git a/src/stat/stat.rs b/src/stat/stat.rs index 83d344048..8c9afd906 100644 --- a/src/stat/stat.rs +++ b/src/stat/stat.rs @@ -85,10 +85,10 @@ macro_rules! print_adjusted { } } -static NAME: &'static str = "stat"; -static VERSION: &'static str = env!("CARGO_PKG_VERSION"); +static NAME: &str = "stat"; +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_ZERO: u8 = 1 << 1; 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 { assert!(s.chars().all(char::is_numeric)); if s.len() < 4 { return s.into();