We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 is currently unable to format code which uses the new (and unstable) attributes on struct fields feature. Demonstration:
rustfmt
$ echo ' > struct Foo { > foo: usize, > #[cfg(feature = "include-bar")] > bar: usize, > } > > fn new_foo() -> Foo { > Foo { > foo: 0, > #[cfg(feature = "include-bar")] > bar: 0, > } > } > ' | rustfmt error: expected identifier, found `#` --> stdin:14:9 | 14 | #[cfg(feature = "include-bar")] | ^
Interestingly, the same code on the Rust playground is simply formatted to remove the #[cfg(feature = "include-bar")] annotation, producing:
#[cfg(feature = "include-bar")]
struct Foo { foo: usize, #[cfg(feature = "include-bar")] bar: usize, } fn new_foo() -> Foo { Foo { foo: 0, bar: 0 } }
The text was updated successfully, but these errors were encountered:
I think this just needs us to update the parser (Syntex)
Sorry, something went wrong.
Update tests
b9d9d4f
Closes rust-lang#984, closes rust-lang#1261, closes rust-lang#1462
Successfully merging a pull request may close this issue.
rustfmt
is currently unable to format code which uses the new (and unstable) attributes on struct fields feature. Demonstration:Interestingly, the same code on the Rust playground is simply formatted to remove the
#[cfg(feature = "include-bar")]
annotation, producing:The text was updated successfully, but these errors were encountered: