comment on leading_body_comments

This commit is contained in:
Brent Westbrook 2025-12-12 10:07:18 -05:00
parent 17a1065fad
commit d24895d424
No known key found for this signature in database
1 changed files with 2 additions and 0 deletions

View File

@ -271,6 +271,8 @@ impl Format<PyFormatContext<'_>> for FormatBody<'_> {
{
trailing_comments(dangling).fmt(f)?;
// Note that `leading_body_comments` have already been formatted as part of
// `dangling` above, but their presence still determines the spacing here.
if leading_body_comments.is_empty() {
space().fmt(f)?;
} else {