Fix unstable set comprehension formatting (#5327)

This commit is contained in:
Micha Reiser 2023-06-23 11:50:24 +02:00 committed by GitHub
parent 930f03de98
commit 2dfa6ff58d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 13 deletions

View file

@ -2,7 +2,7 @@ use crate::comments::Comments;
use crate::expression::parentheses::{
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
};
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
use ruff_formatter::{write, Buffer, FormatResult};
use rustpython_parser::ast::ExprSetComp;
@ -10,8 +10,13 @@ use rustpython_parser::ast::ExprSetComp;
pub struct FormatExprSetComp;
impl FormatNodeRule<ExprSetComp> for FormatExprSetComp {
fn fmt_fields(&self, item: &ExprSetComp, f: &mut PyFormatter) -> FormatResult<()> {
write!(f, [not_yet_implemented(item)])
fn fmt_fields(&self, _item: &ExprSetComp, f: &mut PyFormatter) -> FormatResult<()> {
write!(
f,
[not_yet_implemented_custom_text(
"{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}"
)]
)
}
}