Stop emitting double to_string()#639
Merged
Merged
Conversation
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.
hseg
added a commit
to hseg/pizauth
that referenced
this pull request
May 13, 2026
Also remove unnecessary clones (Instant impls Copy) Cannot enable lints until [grmtools#639] is merged since the generated code for the lexer will cause these to unblockably complain. When it is, re-enable implicit_clone and redundant_clone [grmtools#639]: softdevteam/grmtools#639
hseg
added a commit
to hseg/pizauth
that referenced
this pull request
May 13, 2026
Also remove unnecessary clones (Instant impls Copy) Cannot enable lints until [grmtools#639] is merged since the generated code for the lexer will cause these to unblockably complain. When it is, re-enable implicit_clone and redundant_clone [grmtools#639]: softdevteam/grmtools#639
hseg
added a commit
to hseg/pizauth
that referenced
this pull request
May 13, 2026
Also remove unnecessary clones (Instant impls Copy) Cannot enable lints until [grmtools#639] is merged since the generated code for the lexer will cause these to unblockably complain. When it is, re-enable implicit_clone and redundant_clone [grmtools#639]: softdevteam/grmtools#639
hseg
added a commit
to hseg/pizauth
that referenced
this pull request
May 13, 2026
Also remove unnecessary clones (Instant impls Copy) Cannot enable lints until [grmtools#639] is merged since the generated code for the lexer will cause these to unblockably complain. When it is, re-enable implicit_clone and redundant_clone [grmtools#639]: softdevteam/grmtools#639
Collaborator
|
Thanks, good catch!
I just wanted to note that I've also run into this sort of problem in the past, at that time it was possible to work around with the following kind of mod/use workaround code, I haven't tested this in a long time though. |
Contributor
Author
|
I tried doing that, but I kept getting complaints that the inner module is private, and so inaccessible outside the wrapper.
|
Collaborator
|
Oh, indeed I think it would be |
hseg
added a commit
to hseg/pizauth
that referenced
this pull request
May 15, 2026
Also remove unnecessary clones (Instant impls Copy) Cannot enable lints until [grmtools#639] is merged since the generated code for the lexer will cause these to unblockably complain. When it is, re-enable implicit_clone and redundant_clone [grmtools#639]: softdevteam/grmtools#639
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
d70b294 wrapped
regexin aQuoteToStringwhoseToTokensimplementation nominally handles the necessaryto_string()invocation prior to splicing. However, it didn't make the parallel change to drop the call toto_stringfrom the splice. This results in a redundantregex.to_string().to_string()in the generated code.A minor tweak, with potentially negligible but positive impact if the compiler isn't clever enough. Mostly motivated on my part because the import model for the generated parsers (
include!ing them directly in the code) makes it impossible to get Clippy to shut up about this.