Omit space before '\n' + comment (fixes #457)
This commit is contained in:
parent
7377dfc38c
commit
6ecc18c7de
@ -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);
|
||||
}
|
||||
|
||||
|
8
tests/source/space-not-before-newline.rs
Normal file
8
tests/source/space-not-before-newline.rs
Normal file
@ -0,0 +1,8 @@
|
||||
struct Foo {
|
||||
a: (),
|
||||
// spaces ^^^ to be removed
|
||||
}
|
||||
enum Foo {
|
||||
Bar,
|
||||
// spaces ^^^ to be removed
|
||||
}
|
8
tests/target/space-not-before-newline.rs
Normal file
8
tests/target/space-not-before-newline.rs
Normal file
@ -0,0 +1,8 @@
|
||||
struct Foo {
|
||||
a: (),
|
||||
// spaces ^^^ to be removed
|
||||
}
|
||||
enum Foo {
|
||||
Bar,
|
||||
// spaces ^^^ to be removed
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user