ruff/crates/ruff_python_formatter/src/statement
Charlie Marsh 615337a54d
Remove newline-insertion logic from JoinNodesBuilder (#6205)
## 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
```
2023-07-31 16:58:15 -04:00
..
mod.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_ann_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_assert.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_async_for.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_async_function_def.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_async_with.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_aug_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_break.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_class_def.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_continue.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_delete.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_expr.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_for.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_function_def.rs Remove newline-insertion logic from JoinNodesBuilder (#6205) 2023-07-31 16:58:15 -04:00
stmt_global.rs Add global and nonlocal formatting (#6170) 2023-07-29 14:39:42 +00:00
stmt_if.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_import.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_import_from.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_match.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_nonlocal.rs Add global and nonlocal formatting (#6170) 2023-07-29 14:39:42 +00:00
stmt_pass.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_raise.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_return.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_try.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_try_star.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_type_alias.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_while.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_with.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
suite.rs Remove newline-insertion logic from JoinNodesBuilder (#6205) 2023-07-31 16:58:15 -04:00