Open scottmcm opened 3 years ago
Thanks for the report @scottmcm. As is often the case with these formatting errors, rustfmt isn't properly handling the comments between the assignment operator and the rhs, so it is bailing and reverting to the original formatting to prevent stripping those comments. Your original snippet has a trailing space after the assignment operator, so when that original snippet is restored that trailing space is also retained.
You can resolve the formatting error by removing the trailing space, though note that rustfmt currently won't be doing any formatting of the rhs.
For anyone interested in working on this, it's true that rustfmt on the master
branch (v2.0 RC) doesn't result in the formatting error like rustfmt v1.x but rustfmt v2 still isn't properly handling this either as the indentation and spacing are also off
Thanks for the reply, @calebcartwright. The internal error messaging was enough to clue me in and unblock myself. (And make me realize that I forget to configure my editor on this machine to auto-delete those...)
I will work on this issue.
Also hit this issue:
$ cargo fmt
error[internal]: left behind trailing whitespace
--> /home/john/projects/sl/SL-test-viewer/sltestviewer/src/messages/msgdecodetest.rs:146:146:33
|
146 | let rightanswer =
| ^
|
warning: rustfmt has failed to format. See previous 1 errors.
Same situation as in the bug report above:
let rightanswer =
"TestMessage { test_block1: TestBlock1 { test_block1_item: TestBlock1Item { test1: 258, test2: 00010203-0405-0607-0809-0a0b0c0d0e0f, test3: [1, 2, 3] } } }";
with a space after the "=".
Describe the bug
To Reproduce
Repros on the playground, https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8d26c934db762f2165ab9b0cc4d2ef61