Skip to content

Commit 02ef849

Browse files
committed
Adjust pretty printing accordingly.
1 parent 786797d commit 02ef849

File tree

1 file changed

+8
-47
lines changed

1 file changed

+8
-47
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,22 +2369,10 @@ impl<'a> State<'a> {
23692369
self.print_pat(p);
23702370
}
23712371
}
2372-
PatKind::TupleStruct(ref path, ref elts, ddpos) => {
2372+
PatKind::TupleStruct(ref path, ref elts) => {
23732373
self.print_path(path, true, 0);
23742374
self.popen();
2375-
if let Some(ddpos) = ddpos {
2376-
self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(p));
2377-
if ddpos != 0 {
2378-
self.word_space(",");
2379-
}
2380-
self.s.word("..");
2381-
if ddpos != elts.len() {
2382-
self.s.word(",");
2383-
self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(p));
2384-
}
2385-
} else {
2386-
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
2387-
}
2375+
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
23882376
self.pclose();
23892377
}
23902378
PatKind::Path(None, ref path) => {
@@ -2416,23 +2404,11 @@ impl<'a> State<'a> {
24162404
self.s.space();
24172405
self.s.word("}");
24182406
}
2419-
PatKind::Tuple(ref elts, ddpos) => {
2407+
PatKind::Tuple(ref elts) => {
24202408
self.popen();
2421-
if let Some(ddpos) = ddpos {
2422-
self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(p));
2423-
if ddpos != 0 {
2424-
self.word_space(",");
2425-
}
2426-
self.s.word("..");
2427-
if ddpos != elts.len() {
2428-
self.s.word(",");
2429-
self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(p));
2430-
}
2431-
} else {
2432-
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
2433-
if elts.len() == 1 {
2434-
self.s.word(",");
2435-
}
2409+
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
2410+
if elts.len() == 1 {
2411+
self.s.word(",");
24362412
}
24372413
self.pclose();
24382414
}
@@ -2458,24 +2434,9 @@ impl<'a> State<'a> {
24582434
}
24592435
self.print_expr(end);
24602436
}
2461-
PatKind::Slice(ref before, ref slice, ref after) => {
2437+
PatKind::Slice(ref elts) => {
24622438
self.s.word("[");
2463-
self.commasep(Inconsistent,
2464-
&before[..],
2465-
|s, p| s.print_pat(p));
2466-
if let Some(ref p) = *slice {
2467-
if !before.is_empty() { self.word_space(","); }
2468-
if let PatKind::Wild = p.node {
2469-
// Print nothing
2470-
} else {
2471-
self.print_pat(p);
2472-
}
2473-
self.s.word("..");
2474-
if !after.is_empty() { self.word_space(","); }
2475-
}
2476-
self.commasep(Inconsistent,
2477-
&after[..],
2478-
|s, p| s.print_pat(p));
2439+
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(p));
24792440
self.s.word("]");
24802441
}
24812442
PatKind::Rest => self.s.word(".."),

0 commit comments

Comments
 (0)