-
Notifications
You must be signed in to change notification settings - Fork 932
fix internal error when using rustfmt::skip with newline on stmt #3785
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
Conversation
like below ``` macro_rules! shuffle_done { () => { // need to suppress not to remove indent #[cfg_attr(rustfmt, rustfmt_skip)] simd_shuffle32(); }; } ```
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.
Thank you for the PR!
@rchaser53 IIUC, we only need the diffs in src/expr.rs to fix the issue. I am not sure why we need to update src/visitor.rs in ba9b1bf. Would you mind explaining why we need it?
I misunderstood. We only need the diffs in src/expr.rs to fix the issue. Sorry! |
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.
LGTM, thanks!
src/expr.rs
Outdated
context | ||
.skipped_range | ||
.borrow_mut() | ||
.append(&mut visitor_context.skipped_range.borrow_mut().clone()); |
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.
Nit: we can consume visitor_context
and avoid clone
ing here, though I assume that requires an additional refactoring.
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.
Is it better to delete the clone than to use replace_with? The following code can also be compiled and pass tests:
context
.skipped_range
.borrow_mut()
.append(&mut visitor_context.skipped_range.borrow_mut());
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 think just remove clone is better than using replace_with.
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.
Great, this is much simpler than I first expected 😄 Thanks!
fix: #3717
This PR is to fix the bug reported by BartMassey. I will send the another PR to fix other case including 0xpr03's bug.