-
Notifications
You must be signed in to change notification settings - Fork 892
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 RewriteResult in visit_item #6410
Conversation
return None; | ||
return Err(RewriteError::Unknown); |
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.
Not something we need to do in this PR, but it would be nice to add a new variant to RewriteError
that communicates that rewriting failed because comments would be lost.
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.
I was wondering about this too. Or maybe something more general like KnownLimitation. But would such an error actually be useful over Unknown at runtime?
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.
For the potential comment loss, yes it would be. Eventually we'll want to communicate to end users that we failed to format their code because we weren't expecting to find a comment in a particular location, and in order to avoid removing the comment entirely we're leaving that AST node unformatted.
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.
In some cases we already communicate that to end users, but it's not always consistent.
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.
Makes sense!
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.
Overall code changes look good to me. Should be good to merge after the Diff Check Job completes.
Edit: The job ran successfully ✅
CC #6206