From 2bd345358f14a21ecf52b5514d6b5dbe3e8cbca0 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 8 Aug 2023 10:50:57 +0200 Subject: [PATCH] Simplify `parenthesized` formatting (#6419) --- .../src/expression/parentheses.rs | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/crates/ruff_python_formatter/src/expression/parentheses.rs b/crates/ruff_python_formatter/src/expression/parentheses.rs index 9e72231172..9c2a962bcc 100644 --- a/crates/ruff_python_formatter/src/expression/parentheses.rs +++ b/crates/ruff_python_formatter/src/expression/parentheses.rs @@ -144,22 +144,13 @@ impl<'content, 'ast> FormatParenthesized<'content, 'ast> { impl<'ast> Format> for FormatParenthesized<'_, 'ast> { fn fmt(&self, f: &mut Formatter>) -> FormatResult<()> { let inner = format_with(|f| { - if self.comments.is_empty() { - group(&format_args![ - text(self.left), - &soft_block_indent(&Arguments::from(&self.content)), - text(self.right) - ]) - .fmt(f) - } else { - group(&format_args![ - text(self.left), - &dangling_open_parenthesis_comments(self.comments), - &soft_block_indent(&Arguments::from(&self.content)), - text(self.right) - ]) - .fmt(f) - } + group(&format_args![ + text(self.left), + &dangling_open_parenthesis_comments(self.comments), + &soft_block_indent(&Arguments::from(&self.content)), + text(self.right) + ]) + .fmt(f) }); let current_level = f.context().node_level();