Split ast::PatKind::Enum into tuple struct and path patterns

This commit is contained in:
Vadim Petrochenkov
2016-02-13 15:51:27 +03:00
parent 14adc9bb63
commit 9f414a44a7
8 changed files with 47 additions and 26 deletions

View File

@@ -2478,20 +2478,21 @@ impl<'a> State<'a> {
None => ()
}
}
PatKind::Enum(ref path, ref args_) => {
PatKind::TupleStruct(ref path, ref args_) => {
try!(self.print_path(path, true, 0));
match *args_ {
None => try!(word(&mut self.s, "(..)")),
Some(ref args) => {
if !args.is_empty() {
try!(self.popen());
try!(self.commasep(Inconsistent, &args[..],
|s, p| s.print_pat(&p)));
try!(self.pclose());
}
try!(self.popen());
try!(self.commasep(Inconsistent, &args[..],
|s, p| s.print_pat(&p)));
try!(self.pclose());
}
}
}
PatKind::Path(ref path) => {
try!(self.print_path(path, true, 0));
}
PatKind::QPath(ref qself, ref path) => {
try!(self.print_qpath(path, qself, false));
}