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

Literal Representation Restructure #4811

Merged
merged 14 commits into from Nov 23, 2019
Merged

Literal Representation Restructure #4811

merged 14 commits into from Nov 23, 2019

Conversation

ghost
Copy link

@ghost ghost commented Nov 13, 2019

This pull request restructures the literal_representation module to be easier to understand and maintain. I split the changes into a lot of commits to make reviewing easier.

changelog: none

Michael Wright added 12 commits November 13, 2019 08:26
Combine macro expansion checks. Indentation is a little strange to
avoid rustfmt issue.
Consolidate warning handling using "poor man's try".
Move suffix check into `check_lit` so that it isn't done repeatedly.
Simplify `grouping_hint` by splitting digits into parts and handling
one at a time.

Fixes #4762
Use `split_digit_parts` in `check_lit`.
Add `group_digits` helper function.
Replace `do_lint` with `get_group_size`. Return `None` if there are no
groups.
Store the digit parts directly in DigitInfo since we need them anyway.
Only store valid suffixes (and not mistyped suffixes) in DigitInfo.
Check for mistyped suffixes later and not when DigitInfo is created.
This opens the door to more sophisticated mistyped suffix checks later.
Rename DigitInfo to NumericLiteral
Rename `grouping_hint` to `format` and use the term consistently.
Export function for formatting literals and remove crate visibility from
other items.
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.

Thanks for splitting this innto 12 commits, that made reviewing this a lot easier!

LGTM overall.

clippy_lints/src/literal_representation.rs Show resolved Hide resolved
clippy_lints/src/literal_representation.rs Outdated Show resolved Hide resolved
clippy_lints/src/literal_representation.rs Outdated Show resolved Hide resolved
Michael Wright added 2 commits November 14, 2019 07:42
Simplify calculation in grouping. Add test case to ensure `count()`
can't be zero in that branch.
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.

Thanks! I'm currently working on a rustup, after that, we can merge this.

@flip1995
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 23, 2019

📌 Commit ceb0b2d has been approved by flip1995

flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Nov 23, 2019
Literal Representation Restructure

This pull request restructures the literal_representation module to be easier to understand and maintain. I split the changes into a lot of commits to make reviewing easier.

changelog: none
bors added a commit that referenced this pull request Nov 23, 2019
Rollup of 6 pull requests

Successful merges:

 - #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
 - #4764 (Allow casts from the result of `checked_abs` to unsigned)
 - #4766 (Fix false positive in derive_hash_xor_eq)
 - #4811 (Literal Representation Restructure)
 - #4820 (doc: fix the comment above the lint function)
 - #4830 (use more efficient code to generate repeated string)

Failed merges:

r? @ghost

changelog: none
flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Nov 23, 2019
Literal Representation Restructure

This pull request restructures the literal_representation module to be easier to understand and maintain. I split the changes into a lot of commits to make reviewing easier.

changelog: none
bors added a commit that referenced this pull request Nov 23, 2019
Rollup of 5 pull requests

Successful merges:

 - #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
 - #4766 (Fix false positive in derive_hash_xor_eq)
 - #4811 (Literal Representation Restructure)
 - #4820 (doc: fix the comment above the lint function)
 - #4830 (use more efficient code to generate repeated string)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Nov 23, 2019
Rollup of 5 pull requests

Successful merges:

 - #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
 - #4766 (Fix false positive in derive_hash_xor_eq)
 - #4811 (Literal Representation Restructure)
 - #4820 (doc: fix the comment above the lint function)
 - #4830 (use more efficient code to generate repeated string)

Failed merges:

r? @ghost

changelog: none
@bors bors merged commit ceb0b2d into rust-lang:master Nov 23, 2019
@ghost ghost deleted the lit_repr_20191113 branch December 26, 2019 07:28
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.

2 participants