Comments in structs use appropriate style

Fixes 
This commit is contained in:
David Barnett 2015-11-17 11:57:49 +13:00
parent ce498e6b33
commit 30aec386f4
4 changed files with 20 additions and 3 deletions

@ -1335,7 +1335,10 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext,
},
indent: indent,
width: budget,
ends_with_newline: false,
ends_with_newline: match context.config.struct_lit_style {
StructLitStyle::Block => true,
StructLitStyle::Visual => false,
},
config: context.config,
};
let fields_str = try_opt!(write_list(&item_vec, &fmt));

@ -71,3 +71,10 @@ fn issue201() {
fn issue201_2() {
let s = S{a: S2{ .. c}, .. b};
}
fn issue491() {
Foo {
guard: None,
arm: 0, // Comment
};
}

@ -25,7 +25,7 @@ fn main() {
// Comment
a: foo(), // Comment
// Comment
b: bar(), /* Comment */
b: bar(), // Comment
};
Foo { a: Bar, b: f() };

@ -32,7 +32,7 @@ fn main() {
// Comment
a: foo(), // Comment
// Comment
b: bar(), /* Comment */
b: bar(), // Comment
};
Foo {
@ -107,3 +107,10 @@ fn issue201_2() {
..b
};
}
fn issue491() {
Foo {
guard: None,
arm: 0, // Comment
};
}