-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Even more lexer improvements #102508
Even more lexer improvements #102508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but perhaps this needs a comment on the semanics of spacning for things which are not ops
@bors delegate+ |
✌️ @nnethercote can now approve this pull request |
7128590
to
46907fb
Compare
@bors r=matklad |
📌 Commit 46907fb53c4a18deab627bb8f8ac889fb47843c1 has been approved by It is now in the queue for this repository. |
☔ The latest upstream changes (presumably #102526) made this pull request unmergeable. Please resolve the merge conflicts. |
I found this code hard to read.
An exhaustive match is more readable and more future-proof.
It took me some time to work out what this code was doing.
Because they're very similar, and this will allow some follow-up changes.
It has a single call site.
It's now only used in one function. Also, the "should we glue the tokens?" check is only necessary when pushing a `TokenTree::Token`, not when pushing a `TokenTree::Delimited`. As part of this, we now do the "should we glue the tokens?" check immediately, which avoids having look back at the previous token. It also puts all the logic dealing with token gluing in a single place.
46907fb
to
4e5ddf1
Compare
I rebased. @bors r=matklad |
☀️ Test successful - checks-actions |
Finished benchmarking commit (dbaf3e6): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Footnotes |
These are just about code clarity, rather than performance.
r? @matklad