aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/expressions
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions')
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index 2335d99b3..0d277a586 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -230,14 +230,20 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
230 p.eat(T![async]); 230 p.eat(T![async]);
231 p.eat(T![move]); 231 p.eat(T![move]);
232 params::param_list_closure(p); 232 params::param_list_closure(p);
233 if opt_fn_ret_type(p) && !p.at(T!['{']) { 233 if opt_fn_ret_type(p) {
234 p.error("expected `{`"); 234 if p.at(T!['{']) {
235 } 235 // test lambda_ret_block
236 236 // fn main() { || -> i32 { 92 }(); }
237 if p.at_ts(EXPR_FIRST) { 237 block_expr(p, None);
238 expr(p); 238 } else {
239 p.error("expected `{`");
240 }
239 } else { 241 } else {
240 p.error("expected expression"); 242 if p.at_ts(EXPR_FIRST) {
243 expr(p);
244 } else {
245 p.error("expected expression");
246 }
241 } 247 }
242 m.complete(p, LAMBDA_EXPR) 248 m.complete(p, LAMBDA_EXPR)
243} 249}