Skip to content

Commit 1fcc9ba

Browse files
refactor: gracefully handle parse error in ignored file
1 parent 1ded995 commit 1fcc9ba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/formatting.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ fn format_project<T: FormatHandler>(
8888
) {
8989
Ok(krate) => krate,
9090
// Surface parse error via Session (errors are merged there from report)
91-
Err(ErrorKind::ParseError) => return Ok(report),
91+
Err(ErrorKind::ParseError) => {
92+
// https://github.com/rust-lang/rustfmt/issues/3779
93+
if ignore_path_set.is_match(&main_file) {
94+
return Ok(FormatReport::new());
95+
}
96+
return Ok(report);
97+
}
9298
Err(e) => return Err(e),
9399
};
94100
timer = timer.done_parsing();

0 commit comments

Comments
 (0)