@@ -1459,11 +1459,11 @@ impl<'a> State<'a> {
14591459 self . print_else ( e. as_ref ( ) . map ( |e| & * * e) )
14601460 }
14611461 // "another else-if-let"
1462- ast:: ExprIfLet ( ref pat , ref expr, ref then, ref e) => {
1462+ ast:: ExprIfLet ( ref pats , ref expr, ref then, ref e) => {
14631463 try!( self . cbox ( indent_unit - 1 ) ) ;
14641464 try!( self . ibox ( 0 ) ) ;
14651465 try!( word ( & mut self . s , " else if let " ) ) ;
1466- try!( self . print_pat ( & * * pat ) ) ;
1466+ try!( self . print_pats ( pats ) ) ;
14671467 try!( space ( & mut self . s ) ) ;
14681468 try!( self . word_space ( "=" ) ) ;
14691469 try!( self . print_expr ( & * * expr) ) ;
@@ -1497,10 +1497,10 @@ impl<'a> State<'a> {
14971497 self . print_else ( elseopt)
14981498 }
14991499
1500- pub fn print_if_let ( & mut self , pat : & ast:: Pat , expr : & ast:: Expr , blk : & ast:: Block ,
1500+ pub fn print_if_let ( & mut self , pats : & [ P < ast:: Pat > ] , expr : & ast:: Expr , blk : & ast:: Block ,
15011501 elseopt : Option < & ast:: Expr > ) -> IoResult < ( ) > {
15021502 try!( self . head ( "if let" ) ) ;
1503- try!( self . print_pat ( pat ) ) ;
1503+ try!( self . print_pats ( pats ) ) ;
15041504 try!( space ( & mut self . s ) ) ;
15051505 try!( self . word_space ( "=" ) ) ;
15061506 try!( self . print_expr ( expr) ) ;
@@ -1721,8 +1721,8 @@ impl<'a> State<'a> {
17211721 ast:: ExprIf ( ref test, ref blk, ref elseopt) => {
17221722 try!( self . print_if ( & * * test, & * * blk, elseopt. as_ref ( ) . map ( |e| & * * e) ) ) ;
17231723 }
1724- ast:: ExprIfLet ( ref pat , ref expr, ref blk, ref elseopt) => {
1725- try!( self . print_if_let ( & * * pat , & * * expr, & * * blk, elseopt. as_ref ( ) . map ( |e| & * * e) ) ) ;
1724+ ast:: ExprIfLet ( ref pats , ref expr, ref blk, ref elseopt) => {
1725+ try!( self . print_if_let ( & * * pats , & * * expr, & * * blk, elseopt. as_ref ( ) . map ( |e| & * * e) ) ) ;
17261726 }
17271727 ast:: ExprWhile ( ref test, ref blk, opt_ident) => {
17281728 if let Some ( ident) = opt_ident {
@@ -2253,6 +2253,19 @@ impl<'a> State<'a> {
22532253 self . ann . post ( self , NodePat ( pat) )
22542254 }
22552255
2256+ pub fn print_pats ( & mut self , pats : & [ ast:: Pat ] ) -> IoResult < ( ) > {
2257+ let mut first = true ;
2258+ for ref p in pats {
2259+ if first {
2260+ first = false ;
2261+ } else {
2262+ try!( space ( & mut self . s ) ) ;
2263+ try!( self . word_space ( "|" ) ) ;
2264+ }
2265+ try!( self . print_pat ( & * * p) ) ;
2266+ }
2267+ }
2268+
22562269 fn print_arm ( & mut self , arm : & ast:: Arm ) -> IoResult < ( ) > {
22572270 // I have no idea why this check is necessary, but here it
22582271 // is :(
0 commit comments