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:
konsti 2023-07-11 16:41:10 +02:00 committed by GitHub
parent f1d367655b
commit 62a24e1028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}
}