Skip to content

Commit ca11fb4

Browse files
committed
Reduce format specifier formatter copy depth
1 parent 14ad4c0 commit ca11fb4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

parser/src/fstring.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ impl<'a> FStringParser<'a> {
105105
'}' if in_nested => {
106106
if spec_delims.is_empty() {
107107
in_nested = false;
108+
formatted_value_piece.push(next);
108109
spec_constructor.push(
109110
self.expr(ExprKind::FormattedValue {
110111
value: Box::new(
111112
FStringParser::new(
112-
&format!("{{{}}}", formatted_value_piece),
113+
&formatted_value_piece,
113114
Location::default(),
114115
&self.recurse_lvl + 1,
115116
)
@@ -135,6 +136,7 @@ impl<'a> FStringParser<'a> {
135136
kind: None,
136137
}));
137138
constant_piece.clear();
139+
formatted_value_piece.push(next);
138140
}
139141
'}' => break,
140142
_ => {

0 commit comments

Comments
 (0)