@@ -100,7 +100,7 @@ fn make_diff(expected: &[u8], actual: &[u8], context_size: usize) -> Vec<Mismatc
100100 }
101101
102102 while let Some ( line) = context_queue. pop_front ( ) {
103- assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
103+ debug_assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
104104 mismatch. lines . push ( DiffLine :: Context ( line. to_vec ( ) ) ) ;
105105 }
106106
@@ -112,14 +112,13 @@ fn make_diff(expected: &[u8], actual: &[u8], context_size: usize) -> Vec<Mismatc
112112 lines_since_mismatch = 0 ;
113113 }
114114 diff:: Result :: Both ( str, _) => {
115-
116115 // if one of them is missing a newline and the other isn't, then they don't actually match
117116 if ( line_number_actual > actual_lines_count)
118117 && ( line_number_expected > expected_lines_count)
119118 {
120119 if context_queue. len ( ) < context_size {
121120 while let Some ( line) = context_queue. pop_front ( ) {
122- assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
121+ debug_assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
123122 mismatch. lines . push ( DiffLine :: Context ( line. to_vec ( ) ) ) ;
124123 }
125124 if lines_since_mismatch < context_size {
@@ -137,7 +136,7 @@ fn make_diff(expected: &[u8], actual: &[u8], context_size: usize) -> Vec<Mismatc
137136 ) ;
138137 }
139138 while let Some ( line) = context_queue. pop_front ( ) {
140- assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
139+ debug_assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
141140 mismatch. lines . push ( DiffLine :: Context ( line. to_vec ( ) ) ) ;
142141 }
143142 mismatch. lines . push ( DiffLine :: Expected ( str. to_vec ( ) ) ) ;
@@ -153,15 +152,15 @@ fn make_diff(expected: &[u8], actual: &[u8], context_size: usize) -> Vec<Mismatc
153152 ) ;
154153 }
155154 while let Some ( line) = context_queue. pop_front ( ) {
156- assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
155+ debug_assert ! ( mismatch. lines. last( ) != Some ( & DiffLine :: MissingNL ) ) ;
157156 mismatch. lines . push ( DiffLine :: Context ( line. to_vec ( ) ) ) ;
158157 }
159158 mismatch. lines . push ( DiffLine :: Expected ( str. to_vec ( ) ) ) ;
160159 mismatch. lines . push ( DiffLine :: MissingNL ) ;
161160 mismatch. lines . push ( DiffLine :: Actual ( str. to_vec ( ) ) ) ;
162161 lines_since_mismatch = 0 ;
163162 } else {
164- assert ! ( context_queue. len( ) <= context_size) ;
163+ debug_assert ! ( context_queue. len( ) <= context_size) ;
165164 if context_queue. len ( ) >= context_size {
166165 let _ = context_queue. pop_front ( ) ;
167166 }
@@ -253,8 +252,12 @@ pub fn diff(
253252 DiffLine :: MissingNL => { }
254253 }
255254 }
256- if expected_count == 0 { line_number_expected -= 1 }
257- if actual_count == 0 { line_number_actual -= 1 }
255+ if expected_count == 0 {
256+ line_number_expected -= 1
257+ }
258+ if actual_count == 0 {
259+ line_number_actual -= 1
260+ }
258261 writeln ! (
259262 output,
260263 "@@ -{},{} +{},{} @@" ,
0 commit comments