Inline trailing comments for type alias similar to assignments (#8941)

This commit is contained in:
Micha Reiser 2023-12-04 14:27:04 +09:00 committed by GitHub
parent 8088c5367a
commit 0bf0aa28ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -2,9 +2,8 @@ use ruff_formatter::write;
use ruff_python_ast::StmtTypeAlias;
use crate::comments::{SourceComment, SuppressionKind};
use crate::expression::maybe_parenthesize_expression;
use crate::expression::parentheses::Parenthesize;
use crate::prelude::*;
use crate::statement::stmt_assign::FormatStatementsLastExpression;
#[derive(Default)]
pub struct FormatStmtTypeAlias;
@ -30,7 +29,7 @@ impl FormatNodeRule<StmtTypeAlias> for FormatStmtTypeAlias {
space(),
token("="),
space(),
maybe_parenthesize_expression(value, item, Parenthesize::IfBreaks)
FormatStatementsLastExpression::new(value, item)
]
)
}