Skip to content

Commit 991c829

Browse files
committed
Fix plain string
1 parent 93f3433 commit 991c829

4 files changed

+8
-10
lines changed

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_concat.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_1.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_2.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/parser/src/string.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,16 @@ pub fn parse_strings(
8282
deduped.push(take_current(&mut current));
8383
}
8484

85-
Ok(if has_fstring {
86-
Expr::new(
87-
initial_start,
88-
last_end,
89-
ExprKind::JoinedStr { values: deduped },
90-
)
85+
let node = if has_fstring {
86+
ExprKind::JoinedStr { values: deduped }
9187
} else {
9288
deduped
9389
.into_iter()
9490
.exactly_one()
9591
.expect("String must be concatenated to a single element.")
96-
})
92+
.node
93+
};
94+
Ok(Expr::new(initial_start, last_end, node))
9795
}
9896

9997
#[cfg(test)]

0 commit comments

Comments
 (0)