From b0be69835403ae8db2e99fa583398fa2bc352598 Mon Sep 17 00:00:00 2001 From: Aidan Date: Sat, 17 Aug 2024 00:03:05 -0400 Subject: [PATCH] simplify `StrLiteral::Line` to `StrLiteral::PlainLine` when possible --- crates/compiler/parse/src/normalize.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/compiler/parse/src/normalize.rs b/crates/compiler/parse/src/normalize.rs index 4f37a1e18e..8aafe0f830 100644 --- a/crates/compiler/parse/src/normalize.rs +++ b/crates/compiler/parse/src/normalize.rs @@ -624,6 +624,12 @@ impl<'a> Normalize<'a> for StrLiteral<'a> { new_segments.push(StrSegment::Plaintext(last_text.into_bump_str())); } + if new_segments.len() == 1 { + if let StrSegment::Plaintext(t) = new_segments[0] { + return StrLiteral::PlainLine(t); + } + } + StrLiteral::Line(new_segments.into_bump_slice()) } StrLiteral::Block(t) => {