Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove debug formatting in non-debug locations #323

Open
ltratt opened this issue Jul 21, 2022 · 2 comments
Open

Remove debug formatting in non-debug locations #323

ltratt opened this issue Jul 21, 2022 · 2 comments

Comments

@ltratt
Copy link
Member

ltratt commented Jul 21, 2022

In a couple of places (e.g. https://github.com/softdevteam/grmtools/blob/master/lrlex/src/lib/ctbuilder.rs#L419) we use debug formatting in a non-debug location. This feels somewhat unsatisfactory, particularly as there are fewer guarantees about stability.

@ratmice
Copy link
Collaborator

ratmice commented Oct 9, 2022

I had a look through these, and it appears to me that these just want to be turned into \"{}\".
I.e. they are all names, etc that we wouldn't expect to contain any escape sequences. So I don't
think we need to go as far as something like \"{}\", x.escape_default(), to try mirroring that debug
also escapes.

Edit: The above may not be right, I think actually '\' and '"' may be valid lex names that need escaping here.

@ltratt
Copy link
Member Author

ltratt commented Oct 9, 2022

I think actually '' and '"' may be valid lex names that need escaping here.

Good point! Yes, this needs checking.

ratmice added a commit to ratmice/grmtools that referenced this issue Oct 9, 2022
bors bot added a commit that referenced this issue Oct 9, 2022
358: Clean up issue #323 by using the quote crate. r=ltratt a=ratmice



Co-authored-by: matt rice <[email protected]>
ratmice added a commit to ratmice/grmtools that referenced this issue Oct 9, 2022
bors bot added a commit that referenced this issue Oct 9, 2022
358: Clean up issue #323 by using the quote crate. r=ltratt a=ratmice



Co-authored-by: matt rice <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants