Skip to content

Commit f99167d

Browse files
committed
Fix plain string
1 parent 816e1e7 commit f99167d

4 files changed

Lines changed: 8 additions & 10 deletions

‎parser/src/snapshots/rustpython_parser__string__tests__parse_string_concat.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ expression: parse_ast
2424
end_location: Some(
2525
Location {
2626
row: 1,
27-
column: 8,
27+
column: 16,
2828
},
2929
),
3030
custom: (),

‎parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_1.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ expression: parse_ast
2424
end_location: Some(
2525
Location {
2626
row: 1,
27-
column: 8,
27+
column: 17,
2828
},
2929
),
3030
custom: (),

‎parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_2.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ expression: parse_ast
2424
end_location: Some(
2525
Location {
2626
row: 1,
27-
column: 9,
27+
column: 17,
2828
},
2929
),
3030
custom: (),

‎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)