-
Notifications
You must be signed in to change notification settings - Fork 996
Closed
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICES-duplicateStatus: duplicate of another issue or PRStatus: duplicate of another issue or PR
Description
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:
fn main() {
#[cfg(debug_assertions)]
{ println!("DEBUG"); }
}Run 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) -
From where did you install rustfmt?: I think cargo
-
How do you run rustfmt:
I tried with both
cargo fmtandrustfmt. Both do the same
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICES-duplicateStatus: duplicate of another issue or PRStatus: duplicate of another issue or PR