Omit space before '\n' + comment (fixes #457)

This commit is contained in:
Fabian Zaiser 2017-03-28 16:32:12 +02:00
parent 7377dfc38c
commit 6ecc18c7de
3 changed files with 19 additions and 1 deletions

View File

@ -303,7 +303,9 @@ pub fn write_list<I, T>(items: I, formatting: &ListFormatting) -> Option<String>
Shape::legacy(width, offset),
formatting.config));
result.push(' ');
if !formatted_comment.starts_with('\n') {
result.push(' ');
}
result.push_str(&formatted_comment);
}

View File

@ -0,0 +1,8 @@
struct Foo {
a: (),
// spaces ^^^ to be removed
}
enum Foo {
Bar,
// spaces ^^^ to be removed
}

View File

@ -0,0 +1,8 @@
struct Foo {
a: (),
// spaces ^^^ to be removed
}
enum Foo {
Bar,
// spaces ^^^ to be removed
}