From 2b91ffb3ae03ff53da23036e5d6da7f39c7cff86 Mon Sep 17 00:00:00 2001 From: harupy Date: Sat, 10 Dec 2022 22:01:42 +0900 Subject: [PATCH] Refactor --- parser/src/string.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/parser/src/string.rs b/parser/src/string.rs index cf18de9..b80c629 100644 --- a/parser/src/string.rs +++ b/parser/src/string.rs @@ -81,16 +81,18 @@ pub fn parse_strings( deduped.push(take_current(&mut current)); } - let node = if has_fstring { - ExprKind::JoinedStr { values: deduped } + Ok(if has_fstring { + Expr::new( + initial_start, + last_end, + ExprKind::JoinedStr { values: deduped }, + ) } else { deduped .into_iter() .exactly_one() .expect("String must be concatenated to a single element.") - .node - }; - Ok(Expr::new(initial_start, last_end, node)) + }) } #[cfg(test)]