-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Update last_span in replace_token #12849
Conversation
self.token = next; | ||
self.span = mk_sp(lo, hi); | ||
self.last_span = mk_sp(last_lo, last_hi); |
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.
Why not self.last_span = self.span
?
I'm sure I'm missing something.
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.
(obviously, before self.span = mk_sp(lo, hi)
)
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.
Not missing anything, I just missed tidying this up when I refactored it.
@@ -770,6 +770,7 @@ impl Parser { | |||
next: token::Token, | |||
lo: BytePos, | |||
hi: BytePos) { | |||
self.last_span = mk_sp(self.span.lo, lo); |
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.
What about self.last_span = self.span
? Am I missing something obvious?
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.
The last span is going to be sub-span of self.span, for example with >>, we are replacing the current token with >, so the current span will be the second > and the last span should be the first >, we don't want it to be the span for all of >>
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.
gotcha! thx
internal: Don't parse files unnecessarily in scope_for_offset
…tern, r=Alexendoo Add lint to check manual pattern char comparison This PR adds a new lint asked in rust-lang/rust-clippy#12490 This lint catches manual char comparison in pattern of string functions and propose to use `char` or array of `char` instead. As it's my first contribution i'm not feeling very safe about not matching too much or missing some cases. Thanks in advance for taking time to review and propose feedback ! changelog: new lint [`manual_pattern_char_comparison`]
No description provided.