Skip to content

Commit 9acd471

Browse files
committed
fmt: cargo
1 parent 978dd37 commit 9acd471

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

glass-easel-template-compiler/src/stringify/typescript.rs

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,18 @@ pub(crate) fn generate_tmpl_converted_expr(
5757
w.add_scope_with_ts_keyword_escape(scope_name, &PRESERVED_VAR_NAMES);
5858
w.write_line(|w| {
5959
let pos = location.start;
60-
write_token_series(
61-
["const "],
62-
&(pos..pos),
63-
w,
64-
)?;
60+
write_token_series(["const "], &(pos..pos), w)?;
6561
w.write_token_state(
6662
scope_name,
6763
Some(scope_name),
6864
&location,
6965
StringifierLineState::Normal,
7066
)?;
7167
write_token_series(
72-
["=", "{", "}", "as", "{", "[", "k", ":", "string", "]", ":", "any", "}", ";"],
68+
[
69+
"=", "{", "}", "as", "{", "[", "k", ":", "string", "]", ":", "any", "}",
70+
";",
71+
],
7372
&(pos..pos),
7473
w,
7574
)
@@ -117,12 +116,10 @@ impl ConvertedExprWriteBlock for Node {
117116
&self,
118117
w: &mut StringifierBlock<'s, 't, W>,
119118
) -> FmtResult {
120-
w.new_scope_space(|w| {
121-
match self {
122-
Self::Text(x) => write_dynamic_value(x, w),
123-
Self::Element(x) => x.converted_expr_write(w),
124-
Self::Comment(_) | Self::UnknownMetaTag(_) => Ok(()),
125-
}
119+
w.new_scope_space(|w| match self {
120+
Self::Text(x) => write_dynamic_value(x, w),
121+
Self::Element(x) => x.converted_expr_write(w),
122+
Self::Comment(_) | Self::UnknownMetaTag(_) => Ok(()),
126123
})
127124
}
128125
}
@@ -675,10 +672,19 @@ impl ConvertedExprWriteInline for Value {
675672
if let Some(prev_loc) = prev_loc.take() {
676673
w.write_token_state("+", None, &prev_loc, StringifierLineState::Normal)?;
677674
}
678-
let is_static_str = if let Expression::LitStr { .. } = part { true } else { false };
675+
let is_static_str = if let Expression::LitStr { .. } = part {
676+
true
677+
} else {
678+
false
679+
};
679680
let need_paren = !is_static_str && has_multi_segs;
680681
if need_paren {
681-
w.write_token_state("(", None, &double_brace_location.0, StringifierLineState::Normal)?;
682+
w.write_token_state(
683+
"(",
684+
None,
685+
&double_brace_location.0,
686+
StringifierLineState::Normal,
687+
)?;
682688
}
683689
if let Expression::ToStringWithoutUndefined { value, location } = part {
684690
value.converted_expr_write(w)?;
@@ -689,7 +695,12 @@ impl ConvertedExprWriteInline for Value {
689695
prev_loc = Some(pos..pos);
690696
}
691697
if need_paren {
692-
w.write_token_state(")", None, &double_brace_location.1, StringifierLineState::Normal)?;
698+
w.write_token_state(
699+
")",
700+
None,
701+
&double_brace_location.1,
702+
StringifierLineState::Normal,
703+
)?;
693704
}
694705
Ok(())
695706
})

0 commit comments

Comments
 (0)