Skip to content

Commit

Permalink
Nicer print_pats
Browse files Browse the repository at this point in the history
As per @tamird's suggestion.
  • Loading branch information
Munksgaard committed Mar 16, 2015
1 parent 0a01c49 commit d570bac
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2254,15 +2254,17 @@ impl<'a> State<'a> {
}

pub fn print_pats(&mut self, pats: &[P<ast::Pat>]) -> io::Result<()> {
let mut first = true;
for ref p in pats {
if first {
first = false;
} else {
try!(space(&mut self.s));
try!(self.word_space("|"));
match pats {
[] => {},
[ref p, ref ps..] => {
try!(self.print_pat(&*p));

for p in *ps {
try!(space(&mut self.s));
try!(self.word_space("|"));
try!(self.print_pat(&*p));
}
}
try!(self.print_pat(&**p));
}
Ok(())
}
Expand Down

0 comments on commit d570bac

Please sign in to comment.