mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Support if let
match guards
This commit is contained in:
parent
4466e07fd7
commit
d568e7686a
10 changed files with 90 additions and 27 deletions
|
@ -458,12 +458,17 @@ fn match_arm(p: &mut Parser) {
|
|||
// fn foo() {
|
||||
// match () {
|
||||
// _ if foo => (),
|
||||
// _ if let foo = bar => (),
|
||||
// }
|
||||
// }
|
||||
fn match_guard(p: &mut Parser) -> CompletedMarker {
|
||||
assert!(p.at(T![if]));
|
||||
let m = p.start();
|
||||
p.bump(T![if]);
|
||||
if p.eat(T![let]) {
|
||||
patterns::pattern_top(p);
|
||||
p.expect(T![=]);
|
||||
}
|
||||
expr(p);
|
||||
m.complete(p, MATCH_GUARD)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue