-
Notifications
You must be signed in to change notification settings - Fork 898
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
Use rewrite_assign_rhs_with_comments by ControlFlow rewrite_pat_expr #4626
Use rewrite_assign_rhs_with_comments by ControlFlow rewrite_pat_expr #4626
Conversation
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.
Beautiful thank you! I know you've already got a couple PRs in flight, though if you're interested, one of the outstanding items is backporting the addition of rewrite_assign_rhs_with_comments
(introduced to master branch via #4440) to the latest 1.x branch (rustfmt-1.4.31
at the moment), and then additionally refactoring the code (on both master and 1.x branch) to more fully take advantage
I am interested. Will try to do that after submitting change to an issue I am now evaluating. |
Submitted PR #4632 with the backporting to 1.x the changes to add
I am not sure what type of refactoring you are expecting. Do you have an example of code that you think may be refactored? Should I try to suggest additional comments handling refactoring like the addition of |
#4440 has a more complete picture, but the shortish version: We've historically had a lot of largely duplicative code throughout the codebase that's attempting to handle comments between lhs and rhs by trying to force various
I don't know offhand where every single case is in the current codebase where there's an opportunity to refactor and simplify by switching to use |
The search is relevant to the use of Probably in most cases, calling a Following are the cases I found: |
This overall effort is really just refactoring/cleanup of code, so there's not really any intra-prioritization relative to refactoring one case against another.
Smaller PRs are always preferrable over large ones, so multiple small PRs will just about always be better than one (or fewer) larger ones.
Sorry, but it's not possible to answer that question in the abstract and I don't have the bandwidth to go through each line item (otherwise I'd just make the code changes myself 😄). If you're interested in looking into this, then I'd suggest two basic considerations to use when determining if refactoring a given case would be worthwhile:
|
In all cases I identified there will be no code improvement, since in all just doesn't handle comments, but comments handling will be added.
I will try to make the change to |
Looks like these changes were pulled into the 1.x branch via #4632 |
Change
ControlFlow
rewrite_pat_expr()
to userewrite_assign_rhs_with_comments()
(subset of proposed changes in PR #4578).