1
Fork 0

parse_bottom_expr: extract common 'return' out.

This commit is contained in:
Mazdak Farrokhzad 2019-05-12 02:01:32 +02:00
parent 9b4a630baa
commit b680b66ddd

View file

@ -2643,13 +2643,12 @@ impl<'a> Parser<'a> {
hi = path.span; hi = path.span;
return Ok(self.mk_expr(lo.to(hi), ExprKind::Path(Some(qself), path), attrs)); return Ok(self.mk_expr(lo.to(hi), ExprKind::Path(Some(qself), path), attrs));
} }
if self.span.rust_2018() && self.check_keyword(keywords::Async) if self.span.rust_2018() && self.check_keyword(keywords::Async) {
{ return if self.is_async_block() { // check for `async {` and `async move {`
if self.is_async_block() { // check for `async {` and `async move {` self.parse_async_block(attrs)
return self.parse_async_block(attrs);
} else { } else {
return self.parse_lambda_expr(attrs); self.parse_lambda_expr(attrs)
} };
} }
if self.check_keyword(keywords::Move) || self.check_keyword(keywords::Static) { if self.check_keyword(keywords::Move) || self.check_keyword(keywords::Static) {
return self.parse_lambda_expr(attrs); return self.parse_lambda_expr(attrs);