Skip to content

Commit

Permalink
Don't use group
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer committed Jul 13, 2023
1 parent e1bfaa8 commit 709c4a7
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions crates/ruff_python_formatter/src/statement/stmt_assert.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::expression::maybe_parenthesize_expression;
use crate::expression::parentheses::Parenthesize;
use crate::{FormatNodeRule, PyFormatter};
use ruff_formatter::prelude::{format_args, group, space, text};
use ruff_formatter::prelude::{space, text};
use ruff_formatter::{write, Buffer, FormatResult};
use rustpython_parser::ast::StmtAssert;

Expand All @@ -16,26 +16,23 @@ impl FormatNodeRule<StmtAssert> for FormatStmtAssert {
msg,
} = item;

write!(f, [text("assert"), space()])?;
write!(
f,
[
text("assert"),
space(),
maybe_parenthesize_expression(test, item, Parenthesize::IfBreaks)
]
)?;

if let Some(msg) = msg {
write!(
f,
[group(&format_args![
maybe_parenthesize_expression(test, item, Parenthesize::IfBreaks),
[
text(","),
space(),
maybe_parenthesize_expression(msg, item, Parenthesize::IfBreaks),
])]
)?;
} else {
write!(
f,
[maybe_parenthesize_expression(
test,
item,
Parenthesize::IfBreaks
)]
]
)?;
}

Expand Down

0 comments on commit 709c4a7

Please sign in to comment.