From 7f0053075eb61c0982674dbf143537a6316f04c8 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Sun, 31 May 2026 22:15:19 +0900 Subject: [PATCH] remove some collapsible_if (#12539) * remove some collapsible_if * Use .ok() == .ok() Co-authored-by: Daniel Hofstetter --------- Co-authored-by: oech3 <> Co-authored-by: Daniel Hofstetter --- src/uu/unexpand/src/unexpand.rs | 8 +++----- src/uucore/src/lib/features/fs.rs | 7 +------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 840858c65..b817dcdff 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -115,11 +115,9 @@ fn parse_tabstops(s: &str) -> Result { // Handle the increment if specified // Only add an extra tab stop if increment is non-zero - if let Some(inc) = increment_size { - if inc > 0 { - let last = *nums.last().unwrap(); - nums.push(last + inc); - } + if let Some(inc) = increment_size.filter(|&i| i > 0) { + let last = *nums.last().unwrap(); + nums.push(last + inc); } if let (false, _) = nums diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index aece06bd6..351a29f9d 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -633,12 +633,7 @@ pub fn infos_refer_to_same_file( info1: IOResult, info2: IOResult, ) -> bool { - if let Ok(info1) = info1 { - if let Ok(info2) = info2 { - return info1 == info2; - } - } - false + info1.is_ok() && info1.ok() == info2.ok() } /// Converts absolute `path` to be relative to absolute `to` path.