-
Notifications
You must be signed in to change notification settings - Fork 33
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
Rustfmt cannot format stream! blocks #68
Comments
rustfmt does not format macros that use braces. A known workaround is to combine parentheses and blocks. - let s = async_stream::stream! {
+ let s = async_stream::stream!({
let a = 0u32;
- };
+ }); (Note that the formatting will not work anyway if macro-specific syntax such as |
This is an issue with |
1 task
9 tasks
TroyKomodo
added a commit
to ScuffleCloud/scuffle
that referenced
this issue
Jun 14, 2023
tokio-rs/async-stream#68 pointed out we can use the `stream!({ ... })` macro syntax to force rustfmt to format the inner code block.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take a simple example like
in a new rust project. Add some spaces to break the indentation somewhere in the macro invocation. Run
cargo fmt
. See that Rustfmt completely ignores the code inside of the macro.This already happens in a simple block like
I'm not sure if this is a bug in Rustfmt or something this crate can fix or if there are some Rustfmt options that can be changed to fix this.
My current workaround is to remove the
async_stream::stream!
part, run Rustfmt, add it back.The text was updated successfully, but these errors were encountered: