mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-14 14:25:58 +00:00
Format ExpressionStarred
nodes (#5654)
This commit is contained in:
parent
9f486fa841
commit
987111f5fb
16 changed files with 192 additions and 581 deletions
|
@ -1,22 +1,32 @@
|
|||
use rustpython_parser::ast::ExprStarred;
|
||||
|
||||
use ruff_formatter::write;
|
||||
|
||||
use crate::comments::Comments;
|
||||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprStarred;
|
||||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprStarred;
|
||||
|
||||
impl FormatNodeRule<ExprStarred> for FormatExprStarred {
|
||||
fn fmt_fields(&self, _item: &ExprStarred, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
"*NOT_YET_IMPLEMENTED_ExprStarred"
|
||||
)]
|
||||
)
|
||||
fn fmt_fields(&self, item: &ExprStarred, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
let ExprStarred {
|
||||
range: _,
|
||||
value,
|
||||
ctx: _,
|
||||
} = item;
|
||||
|
||||
write!(f, [text("*"), value.format()])
|
||||
}
|
||||
|
||||
fn fmt_dangling_comments(&self, node: &ExprStarred, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
debug_assert_eq!(f.context().comments().dangling_comments(node), []);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue