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

Cleaner code for unsep literals #4421

Merged
merged 1 commit into from
Aug 26, 2019
Merged

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Aug 20, 2019

Continuing discussion in #4401 (comment)
changelog: none
r? @flip1995

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

This code looks way cleaner than before, thanks!

What about the problem with the assert you mentioned in the other PR?

clippy_lints/src/misc_early.rs Show resolved Hide resolved
clippy_lints/src/misc_early.rs Outdated Show resolved Hide resolved
@flip1995
Copy link
Member

What about the problem with the assert you mentioned in the other PR?

Ah just saw it in the travis build. That's a really weird macro interaction 😄

Can you add a check for span.in_external_macro(). This should solve this issue. Can you also try to reproduce this behavior with a custom written macro?

@flip1995
Copy link
Member

I think it's because of the line! macro. Can you add a test for it?

@tesuji
Copy link
Contributor Author

tesuji commented Aug 20, 2019

Can you add a check for span.in_external_macro().

It already have that check in

fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if in_external_macro(cx.sess(), expr.span) {
return;
}

but it doesn't work as it seems.

I think it's because of the line! macro. Can you add a test for it?

👍

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

I think the in_external_macro check should stay. You should be able to add a check for this with the auxiliary files in the ui test directory.

tests/ui/unseparated_prefix_literals.rs Show resolved Hide resolved
tests/ui/unseparated_prefix_literals.rs Outdated Show resolved Hide resolved
@flip1995 flip1995 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 21, 2019
@tesuji tesuji force-pushed the unsep_literal branch 2 times, most recently from faf63ed to 050bb33 Compare August 23, 2019 13:35
@tesuji
Copy link
Contributor Author

tesuji commented Aug 23, 2019

Tests passed locally.
I cannot find a way to detect line!() macro. Maybe it is eager expansion by compiler?

@flip1995
Copy link
Member

That's a good solution for the line problem. Only 2 more things left and this can be merged

@tesuji
Copy link
Contributor Author

tesuji commented Aug 26, 2019

I resolved comment review. Thank you very much for your help!

@flip1995
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Aug 26, 2019

📌 Commit c1a4b26 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Aug 26, 2019

⌛ Testing commit c1a4b26 with merge b8e5e6f...

bors added a commit that referenced this pull request Aug 26, 2019
Cleaner code for unsep literals

Continuing discussion in #4401 (comment)
changelog: none
r? @flip1995
@bors
Copy link
Contributor

bors commented Aug 26, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: flip1995
Pushing b8e5e6f to master...

@bors bors merged commit c1a4b26 into rust-lang:master Aug 26, 2019
@tesuji tesuji deleted the unsep_literal branch August 26, 2019 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants