diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 778ddf843..6a8649dc1 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1065,10 +1065,13 @@ impl Options { #[cfg(unix)] fn preserve_mode(&self) -> (bool, bool) { match self.attributes.mode { - Preserve::No { explicit } => match explicit { - true => (false, true), - false => (false, false), - }, + Preserve::No { explicit } => { + if explicit { + (false, true) + } else { + (false, false) + } + } Preserve::Yes { .. } => (true, false), } } @@ -2034,9 +2037,10 @@ fn handle_no_preserve_mode(options: &Options, org_mode: u32) -> u32 { { const MODE_RW_UGO: u32 = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; const S_IRWXUGO: u32 = S_IRWXU | S_IRWXG | S_IRWXO; - match is_explicit_no_preserve_mode { - true => return MODE_RW_UGO, - false => return org_mode & S_IRWXUGO, + if is_explicit_no_preserve_mode { + return MODE_RW_UGO; + } else { + return org_mode & S_IRWXUGO; }; } @@ -2051,9 +2055,10 @@ fn handle_no_preserve_mode(options: &Options, org_mode: u32) -> u32 { const MODE_RW_UGO: u32 = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) as u32; const S_IRWXUGO: u32 = (S_IRWXU | S_IRWXG | S_IRWXO) as u32; - match is_explicit_no_preserve_mode { - true => return MODE_RW_UGO, - false => return org_mode & S_IRWXUGO, + if is_explicit_no_preserve_mode { + return MODE_RW_UGO; + } else { + return org_mode & S_IRWXUGO; }; } } diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 1b9194c17..35152c85b 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -408,10 +408,13 @@ fn get_delimiters( } } } - None => match whitespace_delimited { - true => Delimiter::Whitespace, - false => Delimiter::default(), - }, + None => { + if whitespace_delimited { + Delimiter::Whitespace + } else { + Delimiter::default() + } + } }; let out_delim = matches .get_one::(options::OUTPUT_DELIMITER) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ec7fab4e9..65e0969cb 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -763,9 +763,10 @@ fn extract_indicator_style(options: &clap::ArgMatches) -> IndicatorStyle { } fn parse_width(s: &str) -> Result { - let radix = match s.starts_with('0') && s.len() > 1 { - true => 8, - false => 10, + let radix = if s.starts_with('0') && s.len() > 1 { + 8 + } else { + 10 }; match u16::from_str_radix(s, radix) { Ok(x) => Ok(x), diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index ccc97403d..19016900a 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -202,15 +202,14 @@ fn send_signal(process: &mut Child, signal: usize, foreground: bool) { // NOTE: GNU timeout doesn't check for errors of signal. // The subprocess might have exited just after the timeout. // Sending a signal now would return "No such process", but we should still try to kill the children. - match foreground { - true => _ = process.send_signal(signal), - false => { - _ = process.send_signal_group(signal); - let kill_signal = signal_by_name_or_value("KILL").unwrap(); - let continued_signal = signal_by_name_or_value("CONT").unwrap(); - if signal != kill_signal && signal != continued_signal { - _ = process.send_signal_group(continued_signal); - } + if foreground { + let _ = process.send_signal(signal); + } else { + let _ = process.send_signal_group(signal); + let kill_signal = signal_by_name_or_value("KILL").unwrap(); + let continued_signal = signal_by_name_or_value("CONT").unwrap(); + if signal != kill_signal && signal != continued_signal { + _ = process.send_signal_group(continued_signal); } } } diff --git a/src/uucore/src/lib/features/format/spec.rs b/src/uucore/src/lib/features/format/spec.rs index 7c173a3a9..543346bf4 100644 --- a/src/uucore/src/lib/features/format/spec.rs +++ b/src/uucore/src/lib/features/format/spec.rs @@ -217,10 +217,7 @@ impl Spec { if *c == b'u' && flags.hash { return Err(&start[..index]); } - let prefix = match flags.hash { - false => Prefix::No, - true => Prefix::Yes, - }; + let prefix = if flags.hash { Prefix::Yes } else { Prefix::No }; let variant = match c { b'u' => UnsignedIntVariant::Decimal, b'o' => UnsignedIntVariant::Octal(prefix), @@ -245,13 +242,15 @@ impl Spec { b'a' | b'A' => FloatVariant::Hexadecimal, _ => unreachable!(), }, - force_decimal: match flags.hash { - false => ForceDecimal::No, - true => ForceDecimal::Yes, + force_decimal: if flags.hash { + ForceDecimal::Yes + } else { + ForceDecimal::No }, - case: match c.is_ascii_uppercase() { - false => Case::Lowercase, - true => Case::Uppercase, + case: if c.is_ascii_uppercase() { + Case::Uppercase + } else { + Case::Lowercase }, alignment, positive_sign,