]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/print/pprust.rs
Auto merge of #53815 - F001:if-let-guard, r=petrochenkov
[rust.git] / src / libsyntax / print / pprust.rs
index e78e1afe3a4025543dff3f2e856abd82d3edcfae..85d29a5be89db03b1e8303e55d3f9907f41a503f 100644 (file)
@@ -2702,10 +2702,14 @@ fn print_arm(&mut self, arm: &ast::Arm) -> io::Result<()> {
         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("=>")?;