@@ -480,31 +480,25 @@ fn get_input_type(path: &OsString) -> CatResult<InputType> {
480480/// Writes handle to stdout with no configuration. This allows a
481481/// simple memory copy.
482482fn print_fast < R : FdReadable > ( handle : & mut InputHandle < R > ) -> CatResult < ( ) > {
483- let stdout = io:: stdout ( ) ;
484- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
485- let mut stdout = stdout;
486483 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
487484 {
488485 // If we're on Linux or Android, try to use the splice() system call
489486 // for faster writing. If it works, we're done.
490- if !splice:: write_fast_using_splice ( handle, & mut stdout ) ? {
487+ if !splice:: write_fast_using_splice ( handle, & mut * uucore :: stdio :: stdout_raw ( ) ) ? {
491488 return Ok ( ( ) ) ;
492489 }
493490 }
494491 // If we're not on Linux or Android, or the splice() call failed,
495492 // fall back on slower writing.
496- print_unbuffered ( handle, stdout )
493+ print_unbuffered ( handle)
497494}
498495
499496#[ cfg_attr( any( target_os = "linux" , target_os = "android" ) , inline( never) ) ] // splice fast-path does not require this allocation
500- fn print_unbuffered < R : FdReadable > (
501- handle : & mut InputHandle < R > ,
502- stdout : io:: Stdout ,
503- ) -> CatResult < ( ) > {
497+ fn print_unbuffered < R : FdReadable > ( handle : & mut InputHandle < R > ) -> CatResult < ( ) > {
504498 #[ cfg( any( unix, target_os = "wasi" ) ) ]
505- let mut stdout = uucore:: io :: RawWriter ( stdout ) ; // use raw syscall to remove buffering
499+ let mut stdout = uucore:: stdio :: stdout_raw ( ) ;
506500 #[ cfg( not( any( unix, target_os = "wasi" ) ) ) ]
507- let mut stdout = stdout. lock ( ) ;
501+ let mut stdout = io :: stdout ( ) . lock ( ) ;
508502 let mut buf = [ 0 ; 1024 * 64 ] ;
509503 loop {
510504 match handle. reader . read ( & mut buf) {
0 commit comments