diff --git a/src/ls/ls.rs b/src/ls/ls.rs index 9bbc8b338..eef3b8945 100644 --- a/src/ls/ls.rs +++ b/src/ls/ls.rs @@ -62,10 +62,10 @@ static DEFAULT_COLORS: &str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do lazy_static! { static ref LS_COLORS: String = std::env::var("LS_COLORS").unwrap_or_else(|_| DEFAULT_COLORS.to_string()); static ref COLOR_MAP: HashMap<&'static str, &'static str> = { - let codes = LS_COLORS.split(":"); + let codes = LS_COLORS.split(':'); let mut map = HashMap::new(); for c in codes { - let p: Vec<_> = c.split("=").collect(); + let p: Vec<_> = c.split('=').collect(); if p.len() == 2 { map.insert(p[0], p[1]); } diff --git a/src/numfmt/numfmt.rs b/src/numfmt/numfmt.rs index 5a6eedc7a..a8174438f 100644 --- a/src/numfmt/numfmt.rs +++ b/src/numfmt/numfmt.rs @@ -78,7 +78,7 @@ impl fmt::Display for DisplayableSuffix { } fn parse_suffix(s: String) -> Result<(f64, Option)> { - let with_i = s.ends_with("i"); + let with_i = s.ends_with('i'); let mut iter = s.chars(); if with_i { iter.next_back(); diff --git a/src/od/parse_formats.rs b/src/od/parse_formats.rs index ec6370f43..76f472414 100644 --- a/src/od/parse_formats.rs +++ b/src/od/parse_formats.rs @@ -128,7 +128,7 @@ pub fn parse_format_flags(args: &Vec) -> Result Result { // if there is just 1 input (stdin), an offset must start with '+' - if input_strings.len() == 1 && input_strings[0].starts_with("+") { + if input_strings.len() == 1 && input_strings[0].starts_with('+') { return Ok(CommandLineInputs::FileAndOffset(("-".to_string(), n, None))); } if input_strings.len() == 2 { @@ -137,7 +137,7 @@ pub fn parse_offset_operand(s: &str) -> Result { let mut radix = 8; let mut multiply = 1; - if s.starts_with("+") { + if s.starts_with('+') { start += 1; } @@ -145,11 +145,11 @@ pub fn parse_offset_operand(s: &str) -> Result { start += 2; radix = 16; } else { - if s[start..len].ends_with("b") { + if s[start..len].ends_with('b') { len -= 1; multiply = 512; } - if s[start..len].ends_with(".") { + if s[start..len].ends_with('.') { len -= 1; radix = 10; } diff --git a/src/od/parse_nrofbytes.rs b/src/od/parse_nrofbytes.rs index 766e0924d..d2ba1527b 100644 --- a/src/od/parse_nrofbytes.rs +++ b/src/od/parse_nrofbytes.rs @@ -7,7 +7,7 @@ pub fn parse_number_of_bytes(s: &str) -> Result { if s.starts_with("0x") || s.starts_with("0X") { start = 2; radix = 16; - } else if s.starts_with("0") { + } else if s.starts_with('0') { radix = 8; } diff --git a/src/seq/seq.rs b/src/seq/seq.rs index 9c07bc5ec..2558f5122 100644 --- a/src/seq/seq.rs +++ b/src/seq/seq.rs @@ -22,7 +22,7 @@ struct SeqOptions { } fn parse_float(mut s: &str) -> Result { - if s.starts_with("+") { + if s.starts_with('+') { s = &s[1..]; } match s.parse() {