diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index eabf365c8ee..088e8aaa363 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -111,10 +111,10 @@ fn tabstops_parse(s: &str) -> Result<(RemainingMode, Vec), ParseError> { } // Tab sizes must be ascending. - if let Some(last_stop) = nums.last() { - if *last_stop >= num { - return Err(ParseError::TabSizesMustBeAscending); - } + if let Some(last_stop) = nums.last() + && *last_stop >= num + { + return Err(ParseError::TabSizesMustBeAscending); } if is_specifier_already_used { @@ -223,14 +223,15 @@ fn expand_shortcuts(args: Vec) -> Vec { let mut processed_args = Vec::with_capacity(args.len()); for arg in args { - if let Some(arg) = arg.to_str() { - if arg.starts_with('-') && arg[1..].chars().all(is_digit_or_comma) { - arg[1..] - .split(',') - .filter(|s| !s.is_empty()) - .for_each(|s| processed_args.push(OsString::from(format!("--tabs={s}")))); - continue; - } + if let Some(arg) = arg.to_str() + && arg.starts_with('-') + && arg[1..].chars().all(is_digit_or_comma) + { + arg[1..] + .split(',') + .filter(|s| !s.is_empty()) + .for_each(|s| processed_args.push(OsString::from(format!("--tabs={s}")))); + continue; } processed_args.push(arg); } @@ -378,10 +379,10 @@ fn classify_char(buf: &[u8], byte: usize, utf8: bool) -> (CharType, usize, usize return (Other, 1, 1); }; - if let Ok(t) = from_utf8(slice) { - if let Some(c) = t.chars().next() { - return (Other, UnicodeWidthChar::width(c).unwrap_or(0), nbytes); - } + if let Ok(t) = from_utf8(slice) + && let Some(c) = t.chars().next() + { + return (Other, UnicodeWidthChar::width(c).unwrap_or(0), nbytes); } } (Other, 1, 1) // implicit assumption: non-UTF-8 char is 1 col wide