-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
I'm aware how minimal and stable this crate is and has been for a long time, but something that's always put me off from using it (usually in favor of manual #[cfg]
attributes) is how its syntax is completely unfamiliar to rustfmt, and therefore any expressions or items inside of a cfg_if!
block can't get the advantages that rustfmt brings.
// stays as is when `cargo fmt` is run
cfg_if! {
if #[cfg(foobar)] {
fn baz() { qux(); flop()
}
}
else {
fn bar() {
}
}
}
Was there a reason that you didn't choose a more traditional/valid rust syntax for the macro? e.g.
cfg_if!(if cfg!(foobar) {
fn baz() {
qux();
flop()
}
} else {
fn bar() {}
});
I'm aware that rustfmt wasn't as popular/well-integrated in 2017, but I feel like a syntax like this would greatly improve the ergonomics of this crate.
(feel free to ignore, I was just surprised that there wasn't an issue about this already)
Metadata
Metadata
Assignees
Labels
No labels