Skip to content

Commit 424492a

Browse files
committed
or-patterns: syntax: adjust pretty printing.
1 parent ad3db72 commit 424492a

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,11 +1714,11 @@ impl<'a> State<'a> {
17141714
self.ann.post(self, AnnNode::Block(blk))
17151715
}
17161716

1717-
/// Print a `let pats = scrutinee` expression.
1718-
crate fn print_let(&mut self, pats: &[P<ast::Pat>], scrutinee: &ast::Expr) {
1717+
/// Print a `let pat = scrutinee` expression.
1718+
crate fn print_let(&mut self, pat: &ast::Pat, scrutinee: &ast::Expr) {
17191719
self.s.word("let ");
17201720

1721-
self.print_pats(pats);
1721+
self.print_pat(pat);
17221722
self.s.space();
17231723

17241724
self.word_space("=");
@@ -2044,8 +2044,8 @@ impl<'a> State<'a> {
20442044
self.word_space(":");
20452045
self.print_type(ty);
20462046
}
2047-
ast::ExprKind::Let(ref pats, ref scrutinee) => {
2048-
self.print_let(pats, scrutinee);
2047+
ast::ExprKind::Let(ref pat, ref scrutinee) => {
2048+
self.print_let(pat, scrutinee);
20492049
}
20502050
ast::ExprKind::If(ref test, ref blk, ref elseopt) => {
20512051
self.print_if(test, blk, elseopt.as_ref().map(|e| &**e));
@@ -2455,21 +2455,16 @@ impl<'a> State<'a> {
24552455
self.ann.post(self, AnnNode::Pat(pat))
24562456
}
24572457

2458-
fn print_pats(&mut self, pats: &[P<ast::Pat>]) {
2459-
self.strsep("|", true, Inconsistent, pats, |s, p| s.print_pat(p));
2460-
}
2461-
24622458
fn print_arm(&mut self, arm: &ast::Arm) {
2463-
// I have no idea why this check is necessary, but here it
2464-
// is :(
2459+
// I have no idea why this check is necessary, but here it is :(
24652460
if arm.attrs.is_empty() {
24662461
self.s.space();
24672462
}
24682463
self.cbox(INDENT_UNIT);
24692464
self.ibox(0);
2470-
self.maybe_print_comment(arm.pats[0].span.lo());
2465+
self.maybe_print_comment(arm.pat.span.lo());
24712466
self.print_outer_attributes(&arm.attrs);
2472-
self.print_pats(&arm.pats);
2467+
self.print_pat(&arm.pat);
24732468
self.s.space();
24742469
if let Some(ref e) = arm.guard {
24752470
self.word_space("if");

0 commit comments

Comments
 (0)