@@ -333,7 +333,7 @@ impl FormattingError {
333333
334334 pub ( crate ) fn is_internal ( & self ) -> bool {
335335 match self . kind {
336- ErrorKind :: LineOverflow ( .. )
336+ ErrorKind :: LineOverflow { .. }
337337 | ErrorKind :: TrailingWhitespace
338338 | ErrorKind :: IoError ( _)
339339 | ErrorKind :: ParseError
@@ -354,9 +354,13 @@ impl FormattingError {
354354 // (space, target)
355355 pub ( crate ) fn format_len ( & self ) -> ( usize , usize ) {
356356 match self . kind {
357- ErrorKind :: LineOverflow ( _, _, byte_start) => {
358- ( byte_start, self . line_buffer . len ( ) - byte_start)
359- }
357+ ErrorKind :: LineOverflow {
358+ overflow_start_byte,
359+ ..
360+ } => (
361+ overflow_start_byte,
362+ self . line_buffer . len ( ) - overflow_start_byte,
363+ ) ,
360364 ErrorKind :: TrailingWhitespace
361365 | ErrorKind :: DeprecatedAttr
362366 | ErrorKind :: BadAttr
@@ -566,10 +570,13 @@ impl<'a> FormatLines<'a> {
566570 }
567571
568572 // Check for any line width errors we couldn't correct.
569- let max = self . config . max_width ( ) ;
570- let error_kind =
571- ErrorKind :: LineOverflow ( self . line_len , max, self . byte_offset_at_col ( max) ) ;
572- if self . line_len > max
573+ let max_width = self . config . max_width ( ) ;
574+ let error_kind = ErrorKind :: LineOverflow {
575+ total_line_width : self . line_len ,
576+ max_width,
577+ overflow_start_byte : self . byte_offset_at_col ( max_width) ,
578+ } ;
579+ if self . line_len > max_width
573580 && !self . is_skipped_line ( )
574581 && self . should_report_error ( kind, & error_kind)
575582 {
@@ -641,7 +648,7 @@ impl<'a> FormatLines<'a> {
641648 } ;
642649
643650 match error_kind {
644- ErrorKind :: LineOverflow ( .. ) => {
651+ ErrorKind :: LineOverflow { .. } => {
645652 self . config . error_on_line_overflow ( ) && allow_error_report
646653 }
647654 ErrorKind :: TrailingWhitespace | ErrorKind :: LostComment => allow_error_report,
0 commit comments