提交 e0845eb5 编写于 作者: N Niko Matsakis

repr: emit closing `)` for enum variants, test that nullary variants names print

上级 e21b48c0
......@@ -508,7 +508,7 @@ fn visit_leave_enum_variant(_variant: uint,
_disr_val: int,
n_fields: uint,
_name: &str) -> bool {
if !self.printer.skip && n_fields > 1 {
if !self.printer.skip && n_fields >= 1 {
self.printer.writer.write_char(')');
}
true
......
......@@ -4,8 +4,13 @@ enum foo {
c,
}
enum bar {
d, e, f
}
fn main() {
assert ~"a(22)" == fmt!("%?", a(22u));
assert ~"b(~\"hi\")" == fmt!("%?", b(~"hi"));
assert ~"c" == fmt!("%?", c);
assert ~"d" == fmt!("%?", d);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册