Rollup merge of #45258 - hdhoang:master, r=alexcrichton

compiletest/runtest: format ErrorKind with Display

The strings are nouns for the most part, so we give ErrorKind::Help a
more sensible string. This reduces quote hiccups in failure output.

unexpected "error": '...'
↓
unexpected error: '...'
This commit is contained in:
kennytm 2017-10-15 14:21:54 +08:00 committed by GitHub
commit 34a286bf90
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ impl FromStr for ErrorKind {
impl fmt::Display for ErrorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ErrorKind::Help => write!(f, "help"),
ErrorKind::Help => write!(f, "help message"),
ErrorKind::Error => write!(f, "error"),
ErrorKind::Note => write!(f, "note"),
ErrorKind::Suggestion => write!(f, "suggestion"),

View File

@ -1041,7 +1041,7 @@ actual:\n\
None => {
if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) {
self.error(
&format!("{}:{}: unexpected {:?}: '{}'",
&format!("{}:{}: unexpected {}: '{}'",
file_name,
actual_error.line_num,
actual_error.kind.as_ref()