Pretty print empty structs properly
This commit is contained in:
parent
480374a696
commit
791f545685
1 changed files with 4 additions and 1 deletions
|
|
@ -1537,6 +1537,9 @@ impl<'a> State<'a> {
|
|||
|
||||
ast::ExprStruct(ref path, ref fields, ref wth) => {
|
||||
try!(self.print_path(path, true));
|
||||
if fields.is_empty() && wth.is_none() {
|
||||
return;
|
||||
}
|
||||
try!(word(&mut self.s, "{"));
|
||||
try!(self.commasep_cmnt(
|
||||
Consistent,
|
||||
|
|
@ -1560,7 +1563,7 @@ impl<'a> State<'a> {
|
|||
try!(self.print_expr(&**expr));
|
||||
try!(self.end());
|
||||
}
|
||||
_ => try!(word(&mut self.s, ","))
|
||||
_ => try!(word(&mut self.s, ",")),
|
||||
}
|
||||
try!(word(&mut self.s, "}"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue