mirror of https://github.com/astral-sh/ruff
save f.context.comments() to comments
This commit is contained in:
parent
0f1ea90c5c
commit
5fee7534f7
|
|
@ -405,11 +405,9 @@ impl Format<PyFormatContext<'_>> for FormatBody<'_> {
|
||||||
// )
|
// )
|
||||||
// )
|
// )
|
||||||
// ```
|
// ```
|
||||||
if is_expression_parenthesized(
|
let comments = f.context().comments();
|
||||||
(*body).into(),
|
if is_expression_parenthesized((*body).into(), comments.ranges(), f.context().source())
|
||||||
f.context().comments().ranges(),
|
&& comments.has_leading(*body)
|
||||||
f.context().source(),
|
|
||||||
) && f.context().comments().has_leading(*body)
|
|
||||||
{
|
{
|
||||||
if leading_body_comments.is_empty() {
|
if leading_body_comments.is_empty() {
|
||||||
write!(
|
write!(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue