diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-28 01:15:33 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-05 08:33:09 +0200 |
| commit | 424492acc863bb83dc70eee5847b9f3d677f5e14 (patch) | |
| tree | c55edfb31fc51f976912e1ac19cf39d247710288 /src/libsyntax | |
| parent | ad3db726d118184780f0ba3703c0c60126db50a7 (diff) | |
| download | rust-424492acc863bb83dc70eee5847b9f3d677f5e14.tar.gz rust-424492acc863bb83dc70eee5847b9f3d677f5e14.zip | |
or-patterns: syntax: adjust pretty printing.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index bead941b20d..6755709d794 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1714,11 +1714,11 @@ impl<'a> State<'a> { self.ann.post(self, AnnNode::Block(blk)) } - /// Print a `let pats = scrutinee` expression. - crate fn print_let(&mut self, pats: &[P<ast::Pat>], scrutinee: &ast::Expr) { + /// Print a `let pat = scrutinee` expression. + crate fn print_let(&mut self, pat: &ast::Pat, scrutinee: &ast::Expr) { self.s.word("let "); - self.print_pats(pats); + self.print_pat(pat); self.s.space(); self.word_space("="); @@ -2044,8 +2044,8 @@ impl<'a> State<'a> { self.word_space(":"); self.print_type(ty); } - ast::ExprKind::Let(ref pats, ref scrutinee) => { - self.print_let(pats, scrutinee); + ast::ExprKind::Let(ref pat, ref scrutinee) => { + self.print_let(pat, scrutinee); } ast::ExprKind::If(ref test, ref blk, ref elseopt) => { self.print_if(test, blk, elseopt.as_ref().map(|e| &**e)); @@ -2455,21 +2455,16 @@ impl<'a> State<'a> { self.ann.post(self, AnnNode::Pat(pat)) } - fn print_pats(&mut self, pats: &[P<ast::Pat>]) { - self.strsep("|", true, Inconsistent, pats, |s, p| s.print_pat(p)); - } - fn print_arm(&mut self, arm: &ast::Arm) { - // I have no idea why this check is necessary, but here it - // is :( + // I have no idea why this check is necessary, but here it is :( if arm.attrs.is_empty() { self.s.space(); } self.cbox(INDENT_UNIT); self.ibox(0); - self.maybe_print_comment(arm.pats[0].span.lo()); + self.maybe_print_comment(arm.pat.span.lo()); self.print_outer_attributes(&arm.attrs); - self.print_pats(&arm.pats); + self.print_pat(&arm.pat); self.s.space(); if let Some(ref e) = arm.guard { self.word_space("if"); |
