mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
Format StmtExpr (#4788)
This commit is contained in:
parent
4cd4b37e74
commit
a401989b7a
4 changed files with 77 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::{verbatim_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
use rustpython_parser::ast::StmtExpr;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -7,6 +7,8 @@ pub struct FormatStmtExpr;
|
|||
|
||||
impl FormatNodeRule<StmtExpr> for FormatStmtExpr {
|
||||
fn fmt_fields(&self, item: &StmtExpr, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [verbatim_text(item.range)])
|
||||
let StmtExpr { value, .. } = item;
|
||||
|
||||
value.format().fmt(f)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue