mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-25 05:53:51 +00:00
Format ModExpression
(#5689)
## Summary We don't use `ModExpression` anywhere but it's part of the AST, removes one `not_implemented_yet` and is a trivial 2-liner, so i implemented formatting for `ModExpression`. ## Test Plan None, this kind of node does not occur in file input. Otherwise all the tests for expressions
This commit is contained in:
parent
f1d367655b
commit
62a24e1028
1 changed files with 4 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use crate::{AsFormat, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{Format, FormatResult};
|
||||
use rustpython_parser::ast::ModExpression;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -7,6 +7,7 @@ pub struct FormatModExpression;
|
|||
|
||||
impl FormatNodeRule<ModExpression> for FormatModExpression {
|
||||
fn fmt_fields(&self, item: &ModExpression, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
let ModExpression { body, range: _ } = item;
|
||||
body.format().fmt(f)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue