Skip to content

Commit f431d42

Browse files
committed
formatting empty where clauses when there are return types
1 parent d5f1200 commit f431d42

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,7 @@ fn rewrite_fn_base(
25602560

25612561
// Comment between return type and the end of the decl.
25622562
let snippet_lo = fd.output.span().hi();
2563-
if where_clause.predicates.is_empty() {
2563+
if where_clause.predicates.is_empty() && !where_clause.has_where_token {
25642564
let snippet_hi = span.hi();
25652565
let snippet = context.snippet(mk_sp(snippet_lo, snippet_hi));
25662566
// Try to preserve the layout of the original snippet.

tests/source/empty-where-clauses.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn foo() -> () where {}

tests/target/empty-where-clauses.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn foo() -> () {}

0 commit comments

Comments
 (0)