Don't panic on license check errors (#3655)

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"`.
This commit is contained in:
Nikhil Benesch 2019-06-25 21:51:11 -04:00 committed by Seiichi Uchida
parent c955b5908e
commit e0e2f0db53

View File

@ -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())