@@ -166,7 +166,7 @@ fn assert_output(source: &Path, expected_filename: &Path) {
166
166
if !compare. is_empty ( ) {
167
167
let mut failures = HashMap :: new ( ) ;
168
168
failures. insert ( source. to_owned ( ) , compare) ;
169
- print_mismatches_default_message ( failures, source . display ( ) ) ;
169
+ print_mismatches_default_message ( failures) ;
170
170
assert ! ( false , "Text does not match expected output" ) ;
171
171
}
172
172
}
@@ -281,7 +281,7 @@ fn check_files(files: Vec<PathBuf>) -> (Vec<FormatReport>, u32, u32) {
281
281
Ok ( report) => reports. push ( report) ,
282
282
Err ( err) => {
283
283
if let IdempotentCheckError :: Mismatch ( msg) = err {
284
- print_mismatches_default_message ( msg, file_name . display ( ) ) ;
284
+ print_mismatches_default_message ( msg) ;
285
285
}
286
286
fails += 1 ;
287
287
}
@@ -293,13 +293,15 @@ fn check_files(files: Vec<PathBuf>) -> (Vec<FormatReport>, u32, u32) {
293
293
( reports, count, fails)
294
294
}
295
295
296
- fn print_mismatches_default_message (
297
- result : HashMap < PathBuf , Vec < Mismatch > > ,
298
- file_name : std:: path:: Display ,
299
- ) {
300
- print_mismatches ( result, |line_num| {
301
- format ! ( "\n Mismatch at {}:{}:" , file_name, line_num)
302
- } ) ;
296
+ fn print_mismatches_default_message ( result : HashMap < PathBuf , Vec < Mismatch > > ) {
297
+ let mut t = term:: stdout ( ) . unwrap ( ) ;
298
+ for ( file_name, diff) in result {
299
+ let mismatch_msg_formatter =
300
+ |line_num| format ! ( "\n Mismatch at {}:{}:" , file_name. display( ) , line_num) ;
301
+ print_diff ( diff, & mismatch_msg_formatter, Color :: Auto ) ;
302
+ }
303
+
304
+ t. reset ( ) . unwrap ( ) ;
303
305
}
304
306
305
307
fn print_mismatches < T : Fn ( u32 ) -> String > (
0 commit comments