-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Two lexer tweaks #36921
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Two lexer tweaks #36921
Conversation
First, assert! is redundant w.r.t. the unwrap() immediately afterwards. Second, `byte_offset_diff` is effectively computed as `current_byte_offset + ch.len_utf8() - current_byte_offset` (with `next` as an intermediate) which is silly and can be simplified.
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
The two branches of this `if` compute the same value. This commit gets rid of the first branch, which makes this calculation identical to the one in scan_block_comment().
efbed79
to
9e3dcb4
Compare
This seems good to me. |
#36470 has been r+'ed now, so I think this PR can be closed (it will have to go through the slightly longer syntax-breaking-change landing process though). We could land this PR directly since it does not change any API, but that would mean rebasing #36470. @nnethercote do you have a preference? |
@bors: r+ |
📌 Commit 9e3dcb4 has been approved by |
Two lexer tweaks 19 days later, I haven't received a review of my commits in rust-lang#36470. In an attempt to make some progress, I'm going to split up the changes. Here are the ones that don't relate to renaming things.
19 days later, I haven't received a review of my commits in #36470. In an attempt to make some progress, I'm going to split up the changes. Here are the ones that don't relate to renaming things.