@@ -17,7 +17,7 @@ use std::env;
1717use std:: ffi:: { OsStr , OsString } ;
1818use std:: fs:: { File , metadata} ;
1919use std:: io;
20- use std:: io:: { BufRead , BufReader , BufWriter , ErrorKind , Read , Seek , SeekFrom , Write , stdin} ;
20+ use std:: io:: { BufRead , BufReader , ErrorKind , Read , Seek , SeekFrom , Write , stdin} ;
2121use std:: path:: Path ;
2222use thiserror:: Error ;
2323use uucore:: display:: Quotable ;
@@ -543,7 +543,7 @@ impl Settings {
543543 & self ,
544544 filename : & OsStr ,
545545 is_new : bool ,
546- ) -> io:: Result < BufWriter < Box < dyn Write > > > {
546+ ) -> io:: Result < Box < dyn Write > > {
547547 if platform:: paths_refer_to_same_file ( & self . input , filename) {
548548 return Err ( io:: Error :: other (
549549 translate ! ( "split-error-would-overwrite-input" , "file" => filename. quote( ) ) ,
@@ -710,7 +710,7 @@ struct ByteChunkWriter<'a> {
710710 /// Once the number of bytes written to this writer exceeds
711711 /// `chunk_size`, a new writer is initialized and assigned to this
712712 /// field.
713- inner : BufWriter < Box < dyn Write > > ,
713+ inner : Box < dyn Write > ,
714714
715715 /// Iterator that yields filenames for each chunk.
716716 filename_iterator : FilenameIterator < ' a > ,
@@ -831,7 +831,7 @@ struct LineChunkWriter<'a> {
831831 /// Once the number of lines written to this writer exceeds
832832 /// `chunk_size`, a new writer is initialized and assigned to this
833833 /// field.
834- inner : BufWriter < Box < dyn Write > > ,
834+ inner : Box < dyn Write > ,
835835
836836 /// Iterator that yields filenames for each chunk.
837837 filename_iterator : FilenameIterator < ' a > ,
@@ -854,7 +854,7 @@ impl<'a> LineChunkWriter<'a> {
854854 fn start_new_chunk (
855855 settings : & Settings ,
856856 filename_iterator : & mut FilenameIterator ,
857- ) -> io:: Result < BufWriter < Box < dyn Write > > > {
857+ ) -> io:: Result < Box < dyn Write > > {
858858 let filename = filename_iterator. next ( ) . ok_or_else ( || {
859859 io:: Error :: other ( translate ! ( "split-error-output-file-suffixes-exhausted" ) )
860860 } ) ?;
@@ -919,7 +919,7 @@ impl Write for LineChunkWriter<'_> {
919919/// Output file parameters
920920struct OutFile {
921921 filename : OsString ,
922- maybe_writer : Option < BufWriter < Box < dyn Write > > > ,
922+ maybe_writer : Option < Box < dyn Write > > ,
923923 is_new : bool ,
924924}
925925
@@ -932,7 +932,7 @@ trait ManageOutFiles {
932932 & mut self ,
933933 idx : usize ,
934934 settings : & Settings ,
935- ) -> UResult < & mut BufWriter < Box < dyn Write > > > ;
935+ ) -> UResult < & mut Box < dyn Write > > ;
936936 /// Initialize a new set of output files
937937 /// Each [`OutFile`] is generated with filename, while the writer for it could be
938938 /// optional, to be instantiated later by the calling function as needed.
@@ -951,11 +951,7 @@ trait ManageOutFiles {
951951 /// are flagged as `is_new=false`, so they can be re-opened for appending
952952 /// instead of created anew if we need to keep writing into them later,
953953 /// i.e. in case of round robin distribution as in [`n_chunks_by_line_round_robin`]
954- fn get_writer (
955- & mut self ,
956- idx : usize ,
957- settings : & Settings ,
958- ) -> UResult < & mut BufWriter < Box < dyn Write > > > ;
954+ fn get_writer ( & mut self , idx : usize , settings : & Settings ) -> UResult < & mut Box < dyn Write > > ;
959955}
960956
961957impl ManageOutFiles for OutFiles {
@@ -1001,7 +997,7 @@ impl ManageOutFiles for OutFiles {
1001997 & mut self ,
1002998 idx : usize ,
1003999 settings : & Settings ,
1004- ) -> UResult < & mut BufWriter < Box < dyn Write > > > {
1000+ ) -> UResult < & mut Box < dyn Write > > {
10051001 let mut count = 0 ;
10061002 // Use-case for doing multiple tries of closing fds:
10071003 // E.g. split running in parallel to other processes (e.g. another split) doing similar stuff,
@@ -1048,11 +1044,7 @@ impl ManageOutFiles for OutFiles {
10481044 }
10491045 }
10501046
1051- fn get_writer (
1052- & mut self ,
1053- idx : usize ,
1054- settings : & Settings ,
1055- ) -> UResult < & mut BufWriter < Box < dyn Write > > > {
1047+ fn get_writer ( & mut self , idx : usize , settings : & Settings ) -> UResult < & mut Box < dyn Write > > {
10561048 if self [ idx] . maybe_writer . is_some ( ) {
10571049 Ok ( self [ idx] . maybe_writer . as_mut ( ) . unwrap ( ) )
10581050 } else {
@@ -1472,7 +1464,7 @@ where
14721464 // to be overwritten for sure at the beginning of the loop below
14731465 // because we start with `remaining == 0`, indicating that a new
14741466 // chunk should start.
1475- let mut writer: BufWriter < Box < dyn Write > > = BufWriter :: new ( Box :: new ( io:: Cursor :: new ( vec ! [ ] ) ) ) ;
1467+ let mut writer: Box < dyn Write > = Box :: new ( io:: Cursor :: new ( vec ! [ ] ) ) ;
14761468
14771469 let mut remaining = 0 ;
14781470 for line in lines_with_sep ( reader, settings. separator ) {
0 commit comments