Merge pull request #618 from zyphrus/master

Comments in structs use appropriate style
This commit is contained in:
Nick Cameron 2015-11-20 18:14:26 +13:00
commit 3533f72c45
5 changed files with 52 additions and 3 deletions

View File

@ -1373,7 +1373,11 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext,
},
indent: indent,
width: budget,
ends_with_newline: false,
ends_with_newline: match tactic {
DefinitiveListTactic::Horizontal => false,
DefinitiveListTactic::Vertical => true,
DefinitiveListTactic::Mixed => unreachable!(),
},
config: context.config,
};
let fields_str = try_opt!(write_list(&item_vec, &fmt));

View File

@ -100,3 +100,17 @@ fn issue123() {
Foo { a: ddddddddddddddddddddd, b: cccccccccccccccccccccccccccccccccccccc };
}
fn issue491() {
Foo {
guard: None,
arm: 0, // Comment
};
Foo {
arm: 0, // Comment
};
Foo { a: aaaaaaaaaa, b: bbbbbbbb, c: cccccccccc, d: dddddddddd, /* a comment */
e: eeeeeeeee };
}

View File

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

View File

@ -25,7 +25,7 @@ fn main() {
// Comment
a: foo(), // Comment
// Comment
b: bar(), /* Comment */
b: bar(), // Comment
};
Foo { a: Bar, b: f() };
@ -132,3 +132,20 @@ fn issue123() {
b: cccccccccccccccccccccccccccccccccccccc,
};
}
fn issue491() {
Foo {
guard: None,
arm: 0, // Comment
};
Foo { arm: 0 /* Comment */ };
Foo {
a: aaaaaaaaaa,
b: bbbbbbbb,
c: cccccccccc,
d: dddddddddd, // a comment
e: eeeeeeeee,
};
}

View File

@ -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
};
}