Skip to content
2 changes: 1 addition & 1 deletion src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ pub(crate) fn format_impl(
generics.where_clause.span,
context.config.brace_style(),
Shape::legacy(where_budget, offset.block_only()),
false,
true,
"{",
where_span_end,
self_ty.span.hi(),
Expand Down
26 changes: 26 additions & 0 deletions tests/source/issue-3071/issue-3071-where-single-line.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// rustfmt-indent_style: Visual
// rustfmt-where_single_line: true

struct A<T>
where T: Send
{
x: u32,
}

impl<T> A<T> where T: Send
{
fn foo() {}
}


struct B<T, K>
where T: Send,
K: Eq
{
y: u32,
}

impl<T,K> B<T,K> where T: Send, K: Eq
{
fn bar() {}
}
25 changes: 25 additions & 0 deletions tests/source/issue-3071/issue-3071.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// rustfmt-indent_style: Visual

struct A<T>
where T: Send
{
x: u32,
}

impl<T> A<T> where T: Send
{
fn foo() {}
}


struct B<T, K>
where T: Send,
K: Eq
{
y: u32,
}

impl<T,K> B<T,K> where T: Send, K: Eq
{
fn bar() {}
}
28 changes: 28 additions & 0 deletions tests/target/issue-3071/issue-3071-where-single-line.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// rustfmt-indent_style: Visual
// rustfmt-where_single_line: true

struct A<T>
where T: Send
{
x: u32,
}

impl<T> A<T>
where T: Send
{
fn foo() {}
}

struct B<T, K>
where T: Send,
K: Eq
{
y: u32,
}

impl<T, K> B<T, K>
where T: Send,
K: Eq
{
fn bar() {}
}
27 changes: 27 additions & 0 deletions tests/target/issue-3071/issue-3071.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// rustfmt-indent_style: Visual

struct A<T>
where T: Send
{
x: u32,
}

impl<T> A<T>
where T: Send
{
fn foo() {}
}

struct B<T, K>
where T: Send,
K: Eq
{
y: u32,
}

impl<T, K> B<T, K>
where T: Send,
K: Eq
{
fn bar() {}
}