Skip to content

Commit

Permalink
Pretty print empty structs properly
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Jan 6, 2015
1 parent 480374a commit 791f545
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libsyntax/print/pprust.rs
Expand Up @@ -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,
Expand All @@ -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, "}"));
}
Expand Down

0 comments on commit 791f545

Please sign in to comment.