Skip to content

Commit 7ad1354

Browse files
fix: improve formatting of arrow functions as arguments
This change modifies `allows_inline_multi_line` to restrict arrow functions with expression bodies from being inline multi-line. This ensures that if such an arrow function overflows the line width, it forces the parent call expression to break its arguments onto multiple lines, rather than allowing a partial split that results in inconsistent formatting. Fixes #753 Fixes #686
1 parent a5b7b20 commit 7ad1354

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/generation/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9793,8 +9793,8 @@ fn allows_inline_multi_line<'a>(node: Node<'a>, context: &Context<'a>, has_sibli
97939793
_ => allows_inline_multi_line(as_expr.type_ann.into(), context, has_siblings),
97949794
}
97959795
}
9796+
Node::ArrowExpr(arrow) => matches!(arrow.body, BlockStmtOrExpr::BlockStmt(_)),
97969797
Node::FnExpr(_)
9797-
| Node::ArrowExpr(_)
97989798
| Node::ObjectLit(_)
97999799
| Node::ArrayLit(_)
98009800
| Node::ObjectPat(_)

0 commit comments

Comments
 (0)