-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Files content get deleted when formatting with #![rustfmt::skip]
attribute
#12458
Comments
This is indeed reproducible with rustfmt, with Here, with We could work around this for the time being by checking if rust-fmt ended up returning nothing we just use the original input. However that is quite hacky. Rustfmt does not return a non-zero exit code under this situation either :\ |
I've bisected this to a regression in rustfmt introduced in: rust-lang/rustfmt#5094 - I've opened an issue in rustfmt on this: rust-lang/rustfmt#5368 |
The fix to rustfmt has landed. So we can probably close this out now - it should be fixed by upgrading to a new nightly tool chain at some point in the future. |
Thanks for your support! That was quick. |
Believe the fix is out in nightly-2021-06-15, plus or minus a day or two |
rust-analyzer version: rust-analyzer version: f94fa62 2022-05-30 stable
rustc version:
code version:
Execute the following steps to reproduce my issue
wait until rust-analyzer is ready, open
src/main.rs
and then press alt + shift + f for formatting the file.The whole content of the file gets truncated. I can't reproduce the issue with
rustfmt
itself, sorustfmt src/main.rs
does nothing (as expected).The text was updated successfully, but these errors were encountered: