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

Update last_span in replace_token #12849

Merged
merged 1 commit into from
Mar 13, 2014
Merged

Update last_span in replace_token #12849

merged 1 commit into from
Mar 13, 2014

Conversation

nrc
Copy link
Member

@nrc nrc commented Mar 12, 2014

No description provided.

self.token = next;
self.span = mk_sp(lo, hi);
self.last_span = mk_sp(last_lo, last_hi);
Copy link
Contributor

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.

Copy link
Contributor

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))

Copy link
Member Author

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);
Copy link
Contributor

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?

Copy link
Member Author

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 >>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha! thx

@bors bors closed this Mar 13, 2014
@bors bors merged commit 0d80de0 into rust-lang:master Mar 13, 2014
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this pull request Jul 24, 2022
internal: Don't parse files unnecessarily in scope_for_offset
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 13, 2024
…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`]
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

Successfully merging this pull request may close these issues.

4 participants