More enum work (#3212)

This commit is contained in:
Jeong YunWon
2023-02-26 01:40:16 +09:00
committed by GitHub
parent 248590224a
commit 84e96cdcd9
12 changed files with 93 additions and 224 deletions

View File

@@ -8,7 +8,6 @@ use crate::context::ASTFormatContext;
use crate::core::helpers::{leading_quote, trailing_quote};
use crate::core::types::Range;
use crate::cst::Expr;
use crate::trivia::Parenthesize;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct StringLiteralPart {
@@ -142,7 +141,7 @@ impl Format<ASTFormatContext<'_>> for StringLiteral<'_> {
write!(
f,
[group(&format_with(|f| {
if matches!(expr.parentheses, Parenthesize::IfExpanded) {
if expr.parentheses.is_if_expanded() {
write!(f, [if_group_breaks(&text("("))])?;
}
for (i, elt) in elts.iter().enumerate() {
@@ -151,7 +150,7 @@ impl Format<ASTFormatContext<'_>> for StringLiteral<'_> {
write!(f, [soft_line_break_or_space()])?;
}
}
if matches!(expr.parentheses, Parenthesize::IfExpanded) {
if expr.parentheses.is_if_expanded() {
write!(f, [if_group_breaks(&text(")"))])?;
}
Ok(())