@@ -166,15 +166,8 @@ pub(super) mod _impl {
166166
167167 /// Symmetrical context before and after the changed hunk.
168168 ctx_size : u32 ,
169- // TODO:
170- // Is there a way to remove `newline` from `UnifiedDiffSink` as it is purely
171- // formatting-related?
172- // One option would be to introduce `HunkHeader` with a method `format_header` that could
173- // then be called outside `UnifiedDiffSink`, potentially taking `newline` as an argument.
174- newline : NewlineSeparator < ' a > ,
175169
176170 buffer : Vec < ( DiffLineType , Vec < u8 > ) > ,
177- header_buf : String ,
178171 delegate : D ,
179172
180173 err : Option < std:: io:: Error > ,
@@ -191,12 +184,7 @@ pub(super) mod _impl {
191184 /// to the sink.
192185 ///
193186 /// The sink's `consume_hunk` method is called for each hunk with structured type information.
194- pub fn new (
195- input : & ' a InternedInput < T > ,
196- consume_hunk : D ,
197- newline_separator : NewlineSeparator < ' a > ,
198- context_size : ContextSize ,
199- ) -> Self {
187+ pub fn new ( input : & ' a InternedInput < T > , consume_hunk : D , context_size : ContextSize ) -> Self {
200188 Self {
201189 interner : & input. interner ,
202190 before : & input. before ,
@@ -209,10 +197,8 @@ pub(super) mod _impl {
209197 ctx_pos : None ,
210198
211199 ctx_size : context_size. symmetrical ,
212- newline : newline_separator,
213200
214201 buffer : Vec :: with_capacity ( 8 ) ,
215- header_buf : String :: new ( ) ,
216202 delegate : consume_hunk,
217203
218204 err : None ,
@@ -237,23 +223,6 @@ pub(super) mod _impl {
237223
238224 let hunk_start = self . before_hunk_start + 1 ;
239225 let hunk_end = self . after_hunk_start + 1 ;
240- self . header_buf . clear ( ) ;
241- std:: fmt:: Write :: write_fmt (
242- & mut self . header_buf ,
243- format_args ! (
244- "@@ -{},{} +{},{} @@{nl}" ,
245- hunk_start,
246- self . before_hunk_len,
247- hunk_end,
248- self . after_hunk_len,
249- nl = match self . newline {
250- NewlineSeparator :: AfterHeaderAndLine ( nl) | NewlineSeparator :: AfterHeaderAndWhenNeeded ( nl) => {
251- nl
252- }
253- }
254- ) ,
255- )
256- . map_err ( |err| std:: io:: Error :: new ( ErrorKind :: Other , err) ) ?;
257226
258227 // TODO:
259228 // Is this explicit conversion necessary?
@@ -394,7 +363,7 @@ pub(super) mod _impl {
394363 } ;
395364 // TODO:
396365 // Should this return a `UnifiedDiff` instead of a `UnifiedDiffSink`?
397- UnifiedDiffSink :: new ( input, formatter, newline_separator , context_size)
366+ UnifiedDiffSink :: new ( input, formatter, context_size)
398367 }
399368
400369 fn format_line ( & mut self , line_type : DiffLineType , content : & [ u8 ] ) {
0 commit comments