Skip to content

Commit 4928624

Browse files
andygroveclaude
andcommitted
perf: remove unnecessary string clone in maybe_concat_string_literal
Replace `s.clone().as_str()` with just `s` since `s` is already a `&String` which can be passed directly to `push_str()`. This removes one String allocation per concatenated string literal when parsing SQL with adjacent string literals like 'foo' 'bar'. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 845e213 commit 4928624

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11299,7 +11299,7 @@ impl<'a> Parser<'a> {
1129911299
while let Token::SingleQuotedString(ref s) | Token::DoubleQuotedString(ref s) =
1130011300
self.peek_token_ref().token
1130111301
{
11302-
str.push_str(s.clone().as_str());
11302+
str.push_str(s);
1130311303
self.advance_token();
1130411304
}
1130511305
}

0 commit comments

Comments
 (0)