Skip to content
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

Explicitly tell rustfmt which sections to format #4729

Closed
qrnch-jan opened this issue Mar 1, 2021 · 1 comment
Closed

Explicitly tell rustfmt which sections to format #4729

qrnch-jan opened this issue Mar 1, 2021 · 1 comment

Comments

@qrnch-jan
Copy link

When we use the tokio::select! { } macro, the arms aren't formatted by rustfmt .. which is understandable.

But the arms do actually contain valid Rust code, so it would be nice if it were possible to tell rustfmt that certain sections are actually valid Rust and should be formatted as such, even though they may appear to be within a context where it normally shouldn't.

@calebcartwright
Copy link
Member

Thanks for reaching out but going to close this as a duplicate/in favor of #8.

Due the nature of how macro calls and defs are represented in the rustc AST, rustfmt would really need to be able format everything. Adding additional moving parts on top of the current machinery to only be able to sometimes format some parts would only add complexity and increase the surface for bugs and butchering of code.

We need a more holistic way of being able to process the token stream but that's a big undertaking that's not an immediate priority. Any updates/communications will be posted on #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants