-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
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.
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.
Thanks for splitting this innto 12 commits, that made reviewing this a lot easier!
LGTM overall.
Simplify calculation in grouping. Add test case to ensure `count()` can't be zero in that branch.
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.
Thanks! I'm currently working on a rustup, after that, we can merge this.
@bors r+ rollup |
📌 Commit ceb0b2d has been approved by |
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
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
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
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
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
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