@@ -517,7 +517,7 @@ fn format_lines(
517
517
report : & FormatReport ,
518
518
) {
519
519
let mut trims = vec ! [ ] ;
520
- let mut last_wspace : Option < usize > = None ;
520
+ let mut last_was_space = false ;
521
521
let mut line_len = 0 ;
522
522
let mut cur_line = 1 ;
523
523
let mut newline_count = 0 ;
@@ -542,7 +542,7 @@ fn format_lines(
542
542
}
543
543
544
544
// Iterate over the chars in the file map.
545
- for ( kind, ( b , c ) ) in CharClasses :: new ( text. chars ( ) . enumerate ( ) ) {
545
+ for ( kind, c ) in CharClasses :: new ( text. chars ( ) ) {
546
546
if c == '\r' {
547
547
continue ;
548
548
}
@@ -563,7 +563,7 @@ fn format_lines(
563
563
if c == '\n' {
564
564
if format_line {
565
565
// Check for (and record) trailing whitespace.
566
- if let Some ( .. ) = last_wspace {
566
+ if last_was_space {
567
567
if should_report_error ( config, kind, is_string, & ErrorKind :: TrailingWhitespace )
568
568
{
569
569
trims. push ( ( cur_line, kind, line_buffer. clone ( ) ) ) ;
@@ -591,19 +591,13 @@ fn format_lines(
591
591
cur_line += 1 ;
592
592
format_line = config. file_lines ( ) . contains_line ( name, cur_line) ;
593
593
newline_count += 1 ;
594
- last_wspace = None ;
594
+ last_was_space = false ;
595
595
line_buffer. clear ( ) ;
596
596
is_string = false ;
597
597
} else {
598
598
newline_count = 0 ;
599
599
line_len += if c == '\t' { config. tab_spaces ( ) } else { 1 } ;
600
- if c. is_whitespace ( ) {
601
- if last_wspace. is_none ( ) {
602
- last_wspace = Some ( b) ;
603
- }
604
- } else {
605
- last_wspace = None ;
606
- }
600
+ last_was_space = c. is_whitespace ( ) ;
607
601
line_buffer. push ( c) ;
608
602
if kind. is_string ( ) {
609
603
is_string = true ;
0 commit comments