Open Aiden2207 opened 2 years ago
Thanks for the report! Confirming that I can reproduce this on rustfmt 1.4.38-nightly (63acf900 2022-03-27)
I'm pretty sure the error can be tracked down to trim_left_preserve_layout
in this match arm:
Rustfmt added an extra indentation to the literal, including inside the string itself. This only occurs when the macro invocation is delimited by curly brackets, it works fine when square or parentheses are used.
Unfortunately this workaround doesn't work for me with rust-analyzer, as it (or cargo fmt
) automatically replace []
and ()
with {}
for me. :(
@zeenix can you please post a code snippet of the issue you're seeing so we can more easily investigate this when we have time, thanks!
@zeenix can you please post a code snippet of the issue you're seeing so we can more easily investigate this when we have time, thanks!
It's in the commit that mentioned this issue: https://github.com/zeenix/endi/commit/868afee95a29293aa3d5aca1a4c6c6d1cc9296d8 . If you split the concat!
arguments over multiple lines, you'll reproduce the issue.
@zeenix It's possible that your issue is related to this one, but it sounds like you're running into https://github.com/rust-lang/rustfmt/issues/5974
@zeenix It's possible that your issue is related to this one, but it sounds like you're running into #5974
Ah, you're likely correct. Thanks.
Code:
expected output:
actual output:
Rustfmt added an extra indentation to the literal, including inside the string itself. This only occurs when the macro invocation is delimited by curly brackets, it works fine when square or parentheses are used.