Skip to content

Commit 1fa6894

Browse files
committed
remove where brace newline
1 parent 26586d9 commit 1fa6894

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/items.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,12 @@ pub fn format_impl(
683683

684684
if is_impl_single_line(context, items, &result, &where_clause_str, item)? {
685685
result.push_str(&where_clause_str);
686-
if where_clause_str.contains('\n') || last_line_contains_single_line_comment(&result) {
687-
result.push_str(&format!("{}{{{}}}", &sep, &sep));
686+
if where_clause_str.contains('\n') {
687+
if last_line_contains_single_line_comment(&result) {
688+
result.push_str(&format!("{}{{{}}}", &sep, &sep));
689+
} else {
690+
result.push_str("\n{}");
691+
}
688692
} else {
689693
result.push_str(" {}");
690694
}

tests/source/configs/where_single_line/true.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ where
2222
fn lorem<Ipsum, Dolor, Sit, Amet>() -> T where Ipsum: Eq {
2323
// body
2424
}
25+
26+
unsafe impl Sync for Foo where (): Send {}

tests/target/configs/where_single_line/true.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2626
where Ipsum: Eq {
2727
// body
2828
}
29+
30+
unsafe impl Sync for Foo
31+
where
32+
(): Send,
33+
{}

0 commit comments

Comments
 (0)