From eb3b56b5df3401b7e07303dbadae84533151f663 Mon Sep 17 00:00:00 2001 From: Devel Date: Sat, 22 Aug 2026 17:02:37 +0300 Subject: [PATCH] tac: simplify error propagation --- src/uu/tac/src/tac.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 079a4a3b25..d82eb61677 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -398,15 +398,11 @@ fn tac(filenames: &[OsString], before: bool, regex: bool, separator: &OsStr) -> // Select the appropriate `tac` algorithm based on whether the // separator is given as a regular expression or a fixed string. - let result = match maybe_pattern { + match maybe_pattern { Some(ref pattern) => buffer_tac_regex(data, pattern, before), None => buffer_tac(data, before, separator), - }; - - // If there is any error in writing the output, terminate immediately. - if let Err(e) = result { - return Err(TacError::WriteError(e).into()); } + .map_err(TacError::WriteError)?; } Ok(()) }