Skip to content

Commit 162df35

Browse files
committed
Stop emitting double to_string
d70b294 wrapped regex in a QuoteToString whose ToTokens implementation nominally handles the necessary to_string() invocation prior to splicing. However, it didn't make the parallel change to drop the call to to_string from the splice. This results in a redundant regex.to_string().to_string() in the generated code.
1 parent 174fbc7 commit 162df35

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lrlex/src/lib/ctbuilder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ where
823823
// We cannot `impl ToToken for Rule` because `Rule` never stores `lex_flags`,
824824
// Thus we reference the local lex_flags variable bound earlier.
825825
quote! {
826-
Rule::new(::lrlex::unstable_api::InternalPublicApi, #tok_id, #n, #n_span, #regex.to_string(),
826+
Rule::new(::lrlex::unstable_api::InternalPublicApi, #tok_id, #n, #n_span, #regex,
827827
vec![#(#start_states),*], #target_state, &lex_flags).unwrap()
828828
}
829829
});

0 commit comments

Comments
 (0)