Skip to content

Commit 45502d2

Browse files
committed
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: '...'
1 parent 2d73972 commit 45502d2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/tools/compiletest/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl FromStr for ErrorKind {
4545
impl fmt::Display for ErrorKind {
4646
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4747
match *self {
48-
ErrorKind::Help => write!(f, "help"),
48+
ErrorKind::Help => write!(f, "help message"),
4949
ErrorKind::Error => write!(f, "error"),
5050
ErrorKind::Note => write!(f, "note"),
5151
ErrorKind::Suggestion => write!(f, "suggestion"),

src/tools/compiletest/src/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ actual:\n\
10401040
None => {
10411041
if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) {
10421042
self.error(
1043-
&format!("{}:{}: unexpected {:?}: '{}'",
1043+
&format!("{}:{}: unexpected {}: '{}'",
10441044
file_name,
10451045
actual_error.line_num,
10461046
actual_error.kind.as_ref()

0 commit comments

Comments
 (0)