From d64c6e768bcae6a21d740dfed7030353e1328f9d Mon Sep 17 00:00:00 2001 From: konstin Date: Tue, 11 Jul 2023 15:57:16 +0200 Subject: [PATCH] Format ModExpression ## 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 --- crates/ruff_python_formatter/src/module/mod_expression.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ruff_python_formatter/src/module/mod_expression.rs b/crates/ruff_python_formatter/src/module/mod_expression.rs index d7a8c40db643d..f6e49fb696bf8 100644 --- a/crates/ruff_python_formatter/src/module/mod_expression.rs +++ b/crates/ruff_python_formatter/src/module/mod_expression.rs @@ -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 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) } }