Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasper
Implement if-let match guards Implements rust-lang/rfcs#2294 (tracking issue: #51114). I probably should do a few more things before this can be merged: - [x] Add tests (added basic tests, more advanced tests could be done in the future?) - [x] Add lint for exhaustive if-let guard (comparable to normal if-let statements) - [x] Fix clippy However since this is a nightly feature maybe it's fine to land this and do those steps in follow-up PRs. Thanks a lot `@matthewjasper` ❤️ for helping me with lowering to MIR! Would you be interested in reviewing this? r? `@ghost` for now
This commit is contained in:
commit
1e1ba7c936
27 changed files with 360 additions and 81 deletions
|
@ -2002,6 +2002,15 @@ impl<'a> State<'a> {
|
|||
self.print_expr(&e);
|
||||
self.s.space();
|
||||
}
|
||||
hir::Guard::IfLet(pat, e) => {
|
||||
self.word_nbsp("if");
|
||||
self.word_nbsp("let");
|
||||
self.print_pat(&pat);
|
||||
self.s.space();
|
||||
self.word_space("=");
|
||||
self.print_expr(&e);
|
||||
self.s.space();
|
||||
}
|
||||
}
|
||||
}
|
||||
self.word_space("=>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue