From df04d0280a7cacfbb56e79ba3dfa7ade9045d961 Mon Sep 17 00:00:00 2001 From: Aaron Ang <67321817+aaron-ang@users.noreply.github.com> Date: Thu, 22 Jan 2026 10:17:17 -0500 Subject: [PATCH] fix: clippy unnecessary unwrap --- src/uu/split/src/split.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index c40a6a07ef0..fcab096e2e0 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -1028,14 +1028,16 @@ impl ManageOutFiles for OutFiles { // Could have hit system limit for open files. // Try to close one previously instantiated writer first for (i, out_file) in self.iter_mut().enumerate() { - if i != idx && out_file.maybe_writer.is_some() { - out_file.maybe_writer.as_mut().unwrap().flush()?; - out_file.maybe_writer = None; - out_file.is_new = false; - count += 1; - - // And then try to instantiate the writer again - continue 'loop1; + if i != idx { + if let Some(writer) = out_file.maybe_writer.as_mut() { + writer.flush()?; + out_file.maybe_writer = None; + out_file.is_new = false; + count += 1; + + // And then try to instantiate the writer again + continue 'loop1; + } } }