@@ -44,7 +44,7 @@ impl<'a> FileDiff<'a> {
4444 Self {
4545 file1,
4646 file2,
47- hunks : Hunks :: new ( ) ,
47+ hunks : Default :: default ( ) ,
4848 format_options,
4949 are_different : false ,
5050 }
@@ -331,7 +331,7 @@ impl<'a> FileDiff<'a> {
331331 Self :: get_header( self . file2, self . format_options. label2( ) )
332332 ) ;
333333
334- let mut diff_disp = ContextDiffDisplay :: new ( ) ;
334+ let mut diff_disp = ContextDiffDisplay :: default ( ) ;
335335
336336 for hunk in self . hunks . hunks ( ) {
337337 // move cursor to the start of context for first hunk
@@ -458,7 +458,7 @@ impl<'a> FileDiff<'a> {
458458 Self :: get_header( self . file2, self . format_options. label2( ) )
459459 ) ;
460460
461- let mut diff_disp = UnifiedDiffDisplay :: new ( ) ;
461+ let mut diff_disp = UnifiedDiffDisplay :: default ( ) ;
462462
463463 for hunk in self . hunks . hunks ( ) {
464464 // move cursor to the start of context for first hunk
@@ -526,6 +526,7 @@ impl<'a> FileDiff<'a> {
526526 }
527527}
528528
529+ #[ derive( Default ) ]
529530pub struct UnifiedDiffDisplay {
530531 curr_pos1 : usize ,
531532 curr_pos2 : usize ,
@@ -540,18 +541,6 @@ pub struct UnifiedDiffDisplay {
540541}
541542
542543impl UnifiedDiffDisplay {
543- pub fn new ( ) -> Self {
544- Self {
545- curr_pos1 : 0 ,
546- curr_pos2 : 0 ,
547- context_start1 : 0 ,
548- context_start2 : 0 ,
549- hunk1_len : 0 ,
550- hunk2_len : 0 ,
551- hunk_lines : String :: new ( ) ,
552- }
553- }
554-
555544 pub fn write_line (
556545 & mut self ,
557546 file : & FileData ,
@@ -607,6 +596,7 @@ impl UnifiedDiffDisplay {
607596 }
608597}
609598
599+ #[ derive( Default ) ]
610600pub struct ContextDiffDisplay {
611601 curr_pos1 : usize ,
612602 curr_pos2 : usize ,
@@ -621,18 +611,6 @@ pub struct ContextDiffDisplay {
621611}
622612
623613impl ContextDiffDisplay {
624- pub fn new ( ) -> Self {
625- Self {
626- curr_pos1 : 0 ,
627- curr_pos2 : 0 ,
628- context_start1 : 0 ,
629- context_start2 : 0 ,
630- hunk1_len : 0 ,
631- hunk2_len : 0 ,
632- hunk_lines : [ String :: new ( ) , String :: new ( ) ] ,
633- }
634- }
635-
636614 pub fn set_context_start ( & mut self ) {
637615 self . context_start1 = self . curr_pos1 + 1 ;
638616 self . context_start2 = self . curr_pos2 + 1 ;
0 commit comments