Skip to content

Commit c084d0e

Browse files
committed
review comments
1 parent 4117c6d commit c084d0e

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

src/libsyntax/parse/diagnostics.rs

+22-26
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,13 @@ impl<'a> Parser<'a> {
274274
self.bump(); // (
275275
let sp = lo.to(self.span);
276276
self.bump(); // )
277-
let mut err = self.struct_span_err(sp, "incorrect use of `await`");
278-
err.span_suggestion(
279-
sp,
280-
"`await` is not a method call, remove the parentheses",
281-
String::new(),
282-
Applicability::MachineApplicable,
283-
);
284-
err.emit()
277+
self.struct_span_err(sp, "incorrect use of `await`")
278+
.span_suggestion(
279+
sp,
280+
"`await` is not a method call, remove the parentheses",
281+
String::new(),
282+
Applicability::MachineApplicable,
283+
).emit()
285284
}
286285
}
287286

@@ -327,12 +326,12 @@ impl<'a> Parser<'a> {
327326
);
328327
} else {
329328
err.note("type ascription is a nightly-only feature that lets \
330-
you annotate an expression with a type: `<expr>: <type>`");
331-
err.span_note(
332-
lhs_span,
333-
"this expression expects an ascribed type after the colon",
334-
);
335-
err.help("this might be indicative of a syntax error elsewhere");
329+
you annotate an expression with a type: `<expr>: <type>`")
330+
.span_note(
331+
lhs_span,
332+
"this expression expects an ascribed type after the colon",
333+
)
334+
.help("this might be indicative of a syntax error elsewhere");
336335
}
337336
}
338337
}
@@ -409,10 +408,10 @@ impl<'a> Parser<'a> {
409408
if self.token.is_keyword(keywords::Pub) {
410409
match self.parse_visibility(false) {
411410
Ok(vis) => {
412-
let mut err = self.diagnostic()
413-
.struct_span_err(vis.span, "unnecessary visibility qualifier");
414-
err.span_label(vis.span, "`pub` not permitted here");
415-
err.emit();
411+
self.diagnostic()
412+
.struct_span_err(vis.span, "unnecessary visibility qualifier")
413+
.span_label(vis.span, "`pub` not permitted here")
414+
.emit();
416415
}
417416
Err(mut err) => err.emit(),
418417
}
@@ -488,15 +487,12 @@ impl<'a> Parser<'a> {
488487
break;
489488
}
490489
}
491-
token::Comma => {
492-
if break_on_semi == SemiColonMode::Comma &&
490+
token::Comma if break_on_semi == SemiColonMode::Comma &&
493491
brace_depth == 0 &&
494-
bracket_depth == 0 {
495-
debug!("recover_stmt_ return - Semi");
496-
break;
497-
} else {
498-
self.bump();
499-
}
492+
bracket_depth == 0 =>
493+
{
494+
debug!("recover_stmt_ return - Semi");
495+
break;
500496
}
501497
_ => {
502498
self.bump()

0 commit comments

Comments
 (0)