mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Support let...else
This commit is contained in:
parent
4675410f07
commit
f8acae7895
13 changed files with 162 additions and 8 deletions
|
@ -102,6 +102,16 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) {
|
|||
expressions::expr(p);
|
||||
}
|
||||
|
||||
if p.at(T![else]) {
|
||||
// test let_else
|
||||
// fn f() { let Some(x) = opt else { return }; }
|
||||
|
||||
let m = p.start();
|
||||
p.bump(T![else]);
|
||||
block_expr(p);
|
||||
m.complete(p, LET_ELSE);
|
||||
}
|
||||
|
||||
match with_semi {
|
||||
StmtWithSemi::No => (),
|
||||
StmtWithSemi::Optional => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue