Fix unstable formatting of trailing end-of-line comments of parenthesized attribute values (#16187)

This commit is contained in:
Micha Reiser 2025-02-18 07:43:51 +00:00 committed by GitHub
parent 82eae511ca
commit 31180a84e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 93 additions and 13 deletions

View file

@ -1391,10 +1391,8 @@ fn handle_attribute_comment<'a>(
.take_while(|token| token.kind == SimpleTokenKind::RParen)
.last()
{
return if comment.start() < right_paren.start() {
CommentPlacement::trailing(attribute.value.as_ref(), comment)
} else {
CommentPlacement::dangling(comment.enclosing_node(), comment)
if comment.start() < right_paren.start() {
return CommentPlacement::trailing(attribute.value.as_ref(), comment);
};
}