-
Notifications
You must be signed in to change notification settings - Fork 876
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
Rustfmt adds extra bracket after cfg feature, breaking build #4630
Comments
Thanks for the report. This is a duplicate of a few prior reports (#4475, #4467, #4452, #4522), which has already been fixed and released so I am going to close. The bug has existed for a while, and the fix for this is available starting from v1.4.26 so I don't think this will justify any kind of emergency backport/rust patch release on stable. In the interim you could consider using nightly (at least temporarily) if that's a possibility for you, so that you could get a newer version that has the fix (the latest nightly is v1.4.30), or alternatively perhaps building from source or grabbing the binaries from the GitHub release (more info here). Otherwise you may just need to add |
Got it, thanks! |
Running rustfmt on this snippet of code:
Rewrites it to the following, inserting two additional opening brackets
{
:To Reproduce
For a minimal working example, I created a new
lib
project with the followinglib.rs
file (gist):This project builds before
cargo fmt
but fails to build after:The following is the diff after
cargo fmt
Expected behavior
Rewrites for whitespace, without additional brackets:
Meta
cargo fmt
The text was updated successfully, but these errors were encountered: