@@ -1736,16 +1736,23 @@ impl<'a> State<'a> {
17361736 None => ( ) ,
17371737 }
17381738 }
1739- PatKind :: TupleStruct ( ref path, ref args_ ) => {
1739+ PatKind :: TupleStruct ( ref path, ref elts , ddpos ) => {
17401740 self . print_path ( path, true , 0 ) ?;
1741- match * args_ {
1742- None => word ( & mut self . s , "(..)" ) ?,
1743- Some ( ref args) => {
1744- self . popen ( ) ?;
1745- self . commasep ( Inconsistent , & args[ ..] , |s, p| s. print_pat ( & p) ) ?;
1746- self . pclose ( ) ?;
1741+ self . popen ( ) ?;
1742+ if let Some ( ddpos) = ddpos {
1743+ self . commasep ( Inconsistent , & elts[ ..ddpos] , |s, p| s. print_pat ( & p) ) ?;
1744+ if ddpos != 0 {
1745+ self . word_space ( "," ) ?;
1746+ }
1747+ word ( & mut self . s , ".." ) ?;
1748+ if ddpos != elts. len ( ) {
1749+ word ( & mut self . s , "," ) ?;
1750+ self . commasep ( Inconsistent , & elts[ ddpos..] , |s, p| s. print_pat ( & p) ) ?;
17471751 }
1752+ } else {
1753+ try!( self . commasep ( Inconsistent , & elts[ ..] , |s, p| s. print_pat ( & p) ) ) ;
17481754 }
1755+ try!( self . pclose ( ) ) ;
17491756 }
17501757 PatKind :: Path ( ref path) => {
17511758 self . print_path ( path, true , 0 ) ?;
@@ -1778,11 +1785,23 @@ impl<'a> State<'a> {
17781785 space ( & mut self . s ) ?;
17791786 word ( & mut self . s , "}" ) ?;
17801787 }
1781- PatKind :: Tup ( ref elts) => {
1788+ PatKind :: Tuple ( ref elts, ddpos ) => {
17821789 self . popen ( ) ?;
1783- self . commasep ( Inconsistent , & elts[ ..] , |s, p| s. print_pat ( & p) ) ?;
1784- if elts. len ( ) == 1 {
1785- word ( & mut self . s , "," ) ?;
1790+ if let Some ( ddpos) = ddpos {
1791+ self . commasep ( Inconsistent , & elts[ ..ddpos] , |s, p| s. print_pat ( & p) ) ?;
1792+ if ddpos != 0 {
1793+ self . word_space ( "," ) ?;
1794+ }
1795+ word ( & mut self . s , ".." ) ?;
1796+ if ddpos != elts. len ( ) {
1797+ word ( & mut self . s , "," ) ?;
1798+ self . commasep ( Inconsistent , & elts[ ddpos..] , |s, p| s. print_pat ( & p) ) ?;
1799+ }
1800+ } else {
1801+ self . commasep ( Inconsistent , & elts[ ..] , |s, p| s. print_pat ( & p) ) ?;
1802+ if elts. len ( ) == 1 {
1803+ word ( & mut self . s , "," ) ?;
1804+ }
17861805 }
17871806 self . pclose ( ) ?;
17881807 }
0 commit comments