From e82ed39707bab871331d5cee578bb11215c123b0 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Mon, 27 Apr 2026 01:20:19 +0900 Subject: [PATCH] cat, splice.rs: replace if with match, add comment --- src/uu/cat/src/splice.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/uu/cat/src/splice.rs b/src/uu/cat/src/splice.rs index 867a32df929..a509ea27117 100644 --- a/src/uu/cat/src/splice.rs +++ b/src/uu/cat/src/splice.rs @@ -21,15 +21,10 @@ pub(super) fn write_fast_using_splice( handle: &InputHandle, write_fd: &mut S, ) -> CatResult { - if splice(&handle.reader, &write_fd, MAX_ROOTLESS_PIPE_SIZE).is_ok() { - Ok( - uucore::pipes::splice_unbounded(&handle.reader, write_fd)? - || might_fuse(&handle.reader), - ) - } else { - Ok( - uucore::pipes::splice_unbounded_broker(&handle.reader, write_fd)? - || might_fuse(&handle.reader), - ) - } + let res = match splice(&handle.reader, &write_fd, MAX_ROOTLESS_PIPE_SIZE) { + Ok(_) => uucore::pipes::splice_unbounded(&handle.reader, write_fd)?, + // both of in/output are not pipe + _ => uucore::pipes::splice_unbounded_broker(&handle.reader, write_fd)?, + }; + Ok(res || might_fuse(&handle.reader)) }