Skip to content

Commit f07d962

Browse files
committed
Don't drop internal warnings in tests
1 parent 5df8c8f commit f07d962

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/test/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,11 @@ fn check_files(files: Vec<PathBuf>, opt_config: &Option<PathBuf>) -> (Vec<Format
630630
}
631631
Ok(report) => reports.push(report),
632632
Err(err) => {
633-
if let IdempotentCheckError::Mismatch(msg) = err {
634-
print_mismatches_default_message(msg);
633+
match err {
634+
IdempotentCheckError::Mismatch(msg) => {
635+
print_mismatches_default_message(msg);
636+
}
637+
IdempotentCheckError::Parse => {}
635638
}
636639
fails += 1;
637640
}
@@ -724,6 +727,10 @@ fn idempotent_check(
724727
if parsing_errors {
725728
return Err(IdempotentCheckError::Parse);
726729
}
730+
if format_report.has_warnings() {
731+
// internal warnings have higher precedence than a formatting mismatch
732+
return Ok(format_report);
733+
}
727734

728735
let mut write_result = HashMap::new();
729736
for (filename, text) in source_file {

0 commit comments

Comments
 (0)