mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-28 02:39:50 +00:00
## Summary
This PR ensures that if a function or class is the first statement in a
nested suite that _isn't_ a function or class body, we insert a leading
newline.
For example, given:
```python
def f():
if True:
def register_type():
pass
```
We _want_ to preserve the newline, whereas today, we remove it.
Note that this only applies when the function or class doesn't have any
leading comments.
Closes https://github.com/astral-sh/ruff/issues/6066.
|
||
|---|---|---|
| .. | ||
| snapshots | ||
| fixtures.rs | ||