-
Notifications
You must be signed in to change notification settings - Fork 888
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
Fix failure with =>
in comment after match =>
#6092
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ding-young
changed the title
[Draft] Fix failure with
Fix failure with Mar 3, 2024
=>
in comment after match =>
=>
in comment after match =>
ding-young
force-pushed
the
comment-escape-arrow
branch
from
March 4, 2024 03:43
ce0e40c
to
0b73d9e
Compare
ytmimi
reviewed
Mar 5, 2024
ding-young
force-pushed
the
comment-escape-arrow
branch
from
March 7, 2024 05:26
f62ea61
to
234fe10
Compare
ytmimi
reviewed
Mar 7, 2024
ytmimi
reviewed
Mar 7, 2024
ytmimi
approved these changes
Mar 12, 2024
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.
Just reviewed this again, and everything works well! Thanks again for taking the time to work on this one. Cheers on your first contribution to rustfmt 🎉
ytmimi
added
release-notes
Needs an associated changelog entry
and removed
pr-follow-up-review-pending
labels
Mar 12, 2024
yuvraj-wale
pushed a commit
to yuvraj-wale/rustfmt
that referenced
this pull request
Mar 28, 2024
* Find arrow with find_last_uncommented * Add version gate for arrow finding fix
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5998
Background
(1) Comment without arrow
=>
(2) Comment without arrow
=>
Previously, second example fails to reformat unlike the first example. The cause was rustfmt returns original code snippet when comment is lost after rewrite. When
rewrite_match_body
, there's logic to check if comment exists between=>
and match body, but it tries to find another=>
in arrow_snippet considering the case with nested match. Since=>
in comment was also caught withrfind()
, the comment was lost, which led to silent failure.Solution
Add extra check whether found
=>
was included in single line comment.TODO