-
Notifications
You must be signed in to change notification settings - Fork 901
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
Leave whitespace for logically grouped comments alone #1283
Comments
Another similar example: Before PA[08].configure(Some(A)); // FTDI_RTS - USART0 RTS
PA[09].configure(None); // ACC_INT1 - FXOS8700CQ Interrupt 1
PA[10].configure(None); // unused
PA[11].configure(Some(A)); // FTDI_OUT - USART0 RX FTDI->SAM4L
PA[12].configure(Some(A)); // FTDI_IN - USART0 TX SAM4L->FTDI
PA[13].configure(None); // RED_LED
PA[14].configure(None); // BLUE_LED
PA[15].configure(None); // GREEN_LED After PA[08].configure(Some(A)); // FTDI_RTS - USART0 RTS
PA[09].configure(None); // ACC_INT1 - FXOS8700CQ Interrupt 1
PA[10].configure(None); // unused
PA[11].configure(Some(A)); // FTDI_OUT - USART0 RX FTDI->SAM4L
PA[12].configure(Some(A)); // FTDI_IN - USART0 TX SAM4L->FTDI
PA[13].configure(None); // RED_LED
PA[14].configure(None); // BLUE_LED
PA[15].configure(None); // GREEN_LED I think the general rule here is that vertically aligned rustfmt v0.6.3 used to leave these alone, v0.7.1 now corrupts them |
Rustfmt is not smart enough to maintain alignment like this, I think what happened is that it always tried to remove the whitespace, but for some reason did not manage to do so in some cases, and that set of cases has changed. |
When there are comments in between binary expressions or chain, rustfmt gives up and just copy & paste the original snippet. That's why the comments inside binary operations are kept aligned, while the spaces between |
In my case I actually want the opposite behaviour, e.g. to stop this:
from becoming this:
|
@teohhanhui - Realize it's a similar theme, but what you're talking about is actually unrelated and a duplicate of #4108 |
Is seems that rustfmt is identifies an ending
|
(or perhaps simply not;
) as a continued block and doesn't mess with the whitespace, but it will change the formatting of the last entry:Before
After
I believe this is a similar but distinct case from #1275
The text was updated successfully, but these errors were encountered: