Avoid unstable formatting in ellipsis-only body with trailing comment (#8984)

## Summary

We should avoid inlining the ellipsis in:

```python
def h():
    ...
    # bye
```

Just as we omit the ellipsis in:

```python
def h():
    # bye
    ...
```

Closes https://github.com/astral-sh/ruff/issues/8905.
This commit is contained in:
Charlie Marsh 2023-12-03 19:15:40 -05:00 committed by GitHub
parent bfae1f1412
commit 6fe8f8a272
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 3 deletions

View file

@ -68,6 +68,10 @@ with True:
with True:
... # comment
with True:
...
# comment
match x:
case 1:
...
@ -99,4 +103,4 @@ try:
except:
... # comment
finally:
... # comment
... # comment