From 0ddd6f487c25274f15eba45473667a7404e42785 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Wed, 6 May 2026 21:48:54 +0900 Subject: [PATCH] wc: remove else --- src/uu/wc/src/count_fast.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/uu/wc/src/count_fast.rs b/src/uu/wc/src/count_fast.rs index 6e0d34fae..bc7e72a4e 100644 --- a/src/uu/wc/src/count_fast.rs +++ b/src/uu/wc/src/count_fast.rs @@ -53,8 +53,9 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result { Err(_) => return Err(byte_count), } } - } else if let Ok((pipe_rd, pipe_wr)) = pipe() { + } else { // input is not pipe. needs broker to use splice() with additional cost + let (pipe_rd, pipe_wr) = pipe().map_err(|_| 0_usize)?; loop { match splice(fd, &pipe_wr, MAX_ROOTLESS_PIPE_SIZE) { Ok(0) => return Ok(byte_count), @@ -65,8 +66,6 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result { Err(_) => return Err(byte_count), } } - } else { - Err(0) } }