Fix when the help message is displayed
Only display the "remove this comma" suggestion when followed by an identifier
This commit is contained in:
parent
6c962e3ec4
commit
fadb86f25d
@ -776,8 +776,8 @@ impl<'a> Parser<'a> {
|
||||
err.span_label(self.span, format!("expected identifier, found {}", token_descr));
|
||||
} else {
|
||||
err.span_label(self.span, "expected identifier");
|
||||
if self.token == token::Comma {
|
||||
err.span_suggestion(self.span, "remove this comma", ",".into());
|
||||
if self.token == token::Comma && self.look_ahead(1, |t| *t.is_ident()) {
|
||||
err.span_suggestion(self.span, "remove this comma", "".into());
|
||||
}
|
||||
}
|
||||
err
|
||||
|
Loading…
Reference in New Issue
Block a user