From 46769245327e81375cd22a31cb91b51b09e21a4a Mon Sep 17 00:00:00 2001 From: Michael Lohmann Date: Tue, 1 Feb 2022 22:02:20 +0100 Subject: [PATCH] cat: cat_path does not need to parse InputType for stdin itself This type is already handled by get_input_type, so we can unify the handling --- src/uu/cat/src/cat.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 3c89d8434..e0e6ed7f0 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -325,15 +325,15 @@ fn cat_path( state: &mut OutputState, out_info: Option<&FileInformation>, ) -> CatResult<()> { - if path == "-" { - let stdin = io::stdin(); - let mut handle = InputHandle { - reader: stdin, - is_interactive: atty::is(atty::Stream::Stdin), - }; - return cat_handle(&mut handle, options, state); - } match get_input_type(path)? { + InputType::StdIn => { + let stdin = io::stdin(); + let mut handle = InputHandle { + reader: stdin, + is_interactive: atty::is(atty::Stream::Stdin), + }; + cat_handle(&mut handle, options, state) + } InputType::Directory => Err(CatError::IsDirectory), #[cfg(unix)] InputType::Socket => {