mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 21:15:19 +00:00
![]() ## Summary This PR moves the "insert empty lines" behavior out of `JoinNodesBuilder` and into the `Suite` formatter. I find it a little confusing that the logic is split between those two formatters right now, and since this is _only_ used in that one place, IMO it is a bit simpler to just inline it and use a single approach to tracking state (right now, both are stateful). The only other place this was used was for decorators. As a side effect, we now remove blank lines in both of these cases, which is a known but intentional deviation from Black (which preserves the empty line before the comment in the first case): ```python @foo # Hello @bar def baz(): pass @foo @bar def baz(): pass ``` |
||
---|---|---|
.. | ||
mod.rs | ||
stmt_ann_assign.rs | ||
stmt_assert.rs | ||
stmt_assign.rs | ||
stmt_async_for.rs | ||
stmt_async_function_def.rs | ||
stmt_async_with.rs | ||
stmt_aug_assign.rs | ||
stmt_break.rs | ||
stmt_class_def.rs | ||
stmt_continue.rs | ||
stmt_delete.rs | ||
stmt_expr.rs | ||
stmt_for.rs | ||
stmt_function_def.rs | ||
stmt_global.rs | ||
stmt_if.rs | ||
stmt_import.rs | ||
stmt_import_from.rs | ||
stmt_match.rs | ||
stmt_nonlocal.rs | ||
stmt_pass.rs | ||
stmt_raise.rs | ||
stmt_return.rs | ||
stmt_try.rs | ||
stmt_try_star.rs | ||
stmt_type_alias.rs | ||
stmt_while.rs | ||
stmt_with.rs | ||
suite.rs |