-
Notifications
You must be signed in to change notification settings - Fork 926
Invalid formating for conditional compilation rule #1668
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
Labels
bug
Panic, non-idempotency, invalid code, etc.
Comments
I have got similar problems. Rustfmt is doing something weird with #[cfg()] and #[cfg_attr()]. Example with #[cfg()]: #[cfg(target_os = "freertos")]
match port_id {
'a' | 'A' => GpioPort { port_address: GPIO_A },
'b' | 'B' => GpioPort { port_address: GPIO_B },
_ => panic!(),
} becomes #[cfg(target_os = "freertos")] #[cfg(target_os = "freertos")]
#[cfg(target_os = "freertos")] match port_id {
'a' | 'A' => GpioPort { port_address: GPIO_A },
'b' | 'B' => GpioPort { port_address: GPIO_B },
_ => panic!(),
} Example with #[cfg_attr()]: #[cfg_attr(not(target_os = "freertos"), allow(unused_variables))] becomes #[cfg_attr(not(target_os = "freertos") /* ) /* ) */, allow(unused_variables))] |
Thanks for raising this issue. Looks like the span from |
Similar problems from me as well. #[cfg(all(not(test), target_os = "macos"))] becomes #[cfg(all(not(test) ), target_os = "macos"))] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Formatter v0.8.6 prodices invalid outup for multiargument conditional compilation rule
Resulting code doesn't compile
Expected:
/// Default path (*nix) #[cfg(all(unix, not(target_os = "macos") , not(target_os = "ios"), not(target_os = "android")))]
Received:
/// Default path (*nix) #[cfg(all(unix, not(target_os = "macos") ), not(target_os = "ios") ), not(target_os = "android")))]
The text was updated successfully, but these errors were encountered: