Auto merge of #53815 - F001:if-let-guard, r=petrochenkov
refactor match guard This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114 The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers. r? @petrochenkov
This commit is contained in:
@@ -2702,10 +2702,14 @@ impl<'a> State<'a> {
|
||||
self.print_outer_attributes(&arm.attrs)?;
|
||||
self.print_pats(&arm.pats)?;
|
||||
self.s.space()?;
|
||||
if let Some(ref e) = arm.guard {
|
||||
self.word_space("if")?;
|
||||
self.print_expr(e)?;
|
||||
self.s.space()?;
|
||||
if let Some(ref g) = arm.guard {
|
||||
match g {
|
||||
ast::Guard::If(ref e) => {
|
||||
self.word_space("if")?;
|
||||
self.print_expr(e)?;
|
||||
self.s.space()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.word_space("=>")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user