diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index a5ba80be2cb..f10579c808c 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -142,7 +142,7 @@ impl OutputOptions { /// We can write fast if we can simply copy the contents of the file to /// stdout, without augmenting the output with e.g. line numbers. - fn can_write_fast(&self) -> bool { + fn can_print_fast(&self) -> bool { !(self.show_tabs || self.show_nonprint || self.show_ends @@ -359,10 +359,10 @@ fn cat_handle( options: &OutputOptions, state: &mut OutputState, ) -> CatResult<()> { - if options.can_write_fast() { - write_fast(handle) + if options.can_print_fast() { + print_fast(handle) } else { - write_lines(handle, options, state) + print_lines(handle, options, state) } } @@ -476,7 +476,7 @@ fn get_input_type(path: &OsString) -> CatResult { /// Writes handle to stdout with no configuration. This allows a /// simple memory copy. -fn write_fast(handle: &mut InputHandle) -> CatResult<()> { +fn print_fast(handle: &mut InputHandle) -> CatResult<()> { let stdout = io::stdout(); #[cfg(any(target_os = "linux", target_os = "android"))] let mut stdout = stdout; @@ -490,12 +490,12 @@ fn write_fast(handle: &mut InputHandle) -> CatResult<()> { } // If we're not on Linux or Android, or the splice() call failed, // fall back on slower writing. - write_slow(handle, stdout) + print_slow(handle, stdout) } #[cfg_attr(any(target_os = "linux", target_os = "android"), inline(never))] // splice fast-path does not require this allocation #[cfg_attr(not(any(target_os = "linux", target_os = "android")), inline)] -fn write_slow(handle: &mut InputHandle, stdout: io::Stdout) -> CatResult<()> { +fn print_slow(handle: &mut InputHandle, stdout: io::Stdout) -> CatResult<()> { let mut stdout_lock = stdout.lock(); let mut buf = [0; 1024 * 64]; loop { @@ -524,7 +524,7 @@ fn write_slow(handle: &mut InputHandle, stdout: io::Stdout) -> /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. -fn write_lines( +fn print_lines( handle: &mut InputHandle, options: &OutputOptions, state: &mut OutputState, diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 468f9ed6c23..df5ee8ff743 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -486,7 +486,7 @@ fn get_quoted_file_name( fn process_token_filesystem(t: &Token, meta: &StatFs, display_name: &str) { match *t { - Token::Byte(byte) => write_raw_byte(byte), + Token::Byte(byte) => print_raw_byte(byte), Token::Char(c) => print!("{c}"), Token::Directive { flag, @@ -696,7 +696,7 @@ fn print_unsigned_hex( pad_and_print(&s, flags.left, width, padding_char); } -fn write_raw_byte(byte: u8) { +fn print_raw_byte(byte: u8) { std::io::stdout().write_all(&[byte]).unwrap(); } @@ -1039,7 +1039,7 @@ impl Stater { _: bool, ) -> Result<(), i32> { match *t { - Token::Byte(byte) => write_raw_byte(byte), + Token::Byte(byte) => print_raw_byte(byte), Token::Char(c) => print!("{c}"), Token::Directive {