Skip to content

Commit

Permalink
Don't panic on license check errors (#3655)
Browse files Browse the repository at this point in the history
Without this case, an ErrorKind::LicenseCheck results in a panic:

    thread 'main' panicked at 'internal error: entered unreachable code', src/tools/rustfmt/src/formatting.rs:320:18

N.B.: errors of this type are only raised when the configuration file
contains `license_tempate_path = "TEMPLATE_FILE"`.
  • Loading branch information
benesch authored and topecongiro committed Jun 26, 2019
1 parent c955b59 commit e0e2f0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/formatting.rs
Expand Up @@ -313,7 +313,8 @@ impl FormattingError {
| ErrorKind::DeprecatedAttr
| ErrorKind::BadIssue(_)
| ErrorKind::BadAttr
| ErrorKind::LostComment => {
| ErrorKind::LostComment
| ErrorKind::LicenseCheck => {
let trailing_ws_start = self
.line_buffer
.rfind(|c: char| !c.is_whitespace())
Expand Down

0 comments on commit e0e2f0d

Please sign in to comment.