review comments

This commit is contained in:
Esteban Küber 2019-05-16 15:25:58 -07:00
parent 4117c6d33c
commit c084d0ed7d

View File

@ -274,14 +274,13 @@ impl<'a> Parser<'a> {
self.bump(); // ( self.bump(); // (
let sp = lo.to(self.span); let sp = lo.to(self.span);
self.bump(); // ) self.bump(); // )
let mut err = self.struct_span_err(sp, "incorrect use of `await`"); self.struct_span_err(sp, "incorrect use of `await`")
err.span_suggestion( .span_suggestion(
sp, sp,
"`await` is not a method call, remove the parentheses", "`await` is not a method call, remove the parentheses",
String::new(), String::new(),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); ).emit()
err.emit()
} }
} }
@ -327,12 +326,12 @@ impl<'a> Parser<'a> {
); );
} else { } else {
err.note("type ascription is a nightly-only feature that lets \ err.note("type ascription is a nightly-only feature that lets \
you annotate an expression with a type: `<expr>: <type>`"); you annotate an expression with a type: `<expr>: <type>`")
err.span_note( .span_note(
lhs_span, lhs_span,
"this expression expects an ascribed type after the colon", "this expression expects an ascribed type after the colon",
); )
err.help("this might be indicative of a syntax error elsewhere"); .help("this might be indicative of a syntax error elsewhere");
} }
} }
} }
@ -409,10 +408,10 @@ impl<'a> Parser<'a> {
if self.token.is_keyword(keywords::Pub) { if self.token.is_keyword(keywords::Pub) {
match self.parse_visibility(false) { match self.parse_visibility(false) {
Ok(vis) => { Ok(vis) => {
let mut err = self.diagnostic() self.diagnostic()
.struct_span_err(vis.span, "unnecessary visibility qualifier"); .struct_span_err(vis.span, "unnecessary visibility qualifier")
err.span_label(vis.span, "`pub` not permitted here"); .span_label(vis.span, "`pub` not permitted here")
err.emit(); .emit();
} }
Err(mut err) => err.emit(), Err(mut err) => err.emit(),
} }
@ -488,15 +487,12 @@ impl<'a> Parser<'a> {
break; break;
} }
} }
token::Comma => { token::Comma if break_on_semi == SemiColonMode::Comma &&
if break_on_semi == SemiColonMode::Comma &&
brace_depth == 0 && brace_depth == 0 &&
bracket_depth == 0 { bracket_depth == 0 =>
debug!("recover_stmt_ return - Semi"); {
break; debug!("recover_stmt_ return - Semi");
} else { break;
self.bump();
}
} }
_ => { _ => {
self.bump() self.bump()