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
#[cfg(...)]
Describe the bug
When formatting a single-line block expression with a #[cfg(...)] attribute before it, an extra open brace is produced.
To Reproduce
main.rs:
main.rs
fn main() { #[cfg(debug_assertions)] { println!("DEBUG"); } }
Run rustfmt main.rs
rustfmt main.rs
main.rs now contains:
fn main() { #[cfg(debug_assertions)] { { println!("DEBUG"); } }
Expected behavior
The braces are put onto different lines correctly
Meta
rustfmt version: rustfmt 1.4.22-nightly (97d03010 2020-10-04)
rustfmt 1.4.22-nightly (97d03010 2020-10-04)
From where did you install rustfmt?: I think cargo
How do you run rustfmt:
I tried with both cargo fmt and rustfmt. Both do the same
cargo fmt
rustfmt
The text was updated successfully, but these errors were encountered:
Thank you for the report, though closing as a duplicate of #4467 and #4452 (comment). Will be addressed in the next rustc-ap bump
Sorry, something went wrong.
No branches or pull requests
Describe the bug
When formatting a single-line block expression with a
#[cfg(...)]
attribute before it, an extra open brace is produced.To Reproduce
main.rs
:Run
rustfmt main.rs
main.rs
now contains:Expected behavior
The braces are put onto different lines correctly
Meta
rustfmt version:
rustfmt 1.4.22-nightly (97d03010 2020-10-04)
From where did you install rustfmt?: I think cargo
How do you run rustfmt:
I tried with both
cargo fmt
andrustfmt
. Both do the sameThe text was updated successfully, but these errors were encountered: