dtolnay/cargo-expand

Feature request: format long code

soerenmeier opened this issue · 1 comments

While expanding some code which uses tokio::select it seemed like no formatting happened. After posting an issue rust-lang/rustfmt#4878 on rustfmt the answer was that it worked as intended.

I'm proposing to add an argument like --fmt-long or something like that, that performs two formatting passes. One with a long max-width and another with the default one.

If that's a feature you would add, I'd be willing to make a PR.

I would prefer not to make a change here. This is squarely territory that a formatter should handle. I would be interested in someone making a formatter that is better than rustfmt, and I would be open to supporting that in cargo-expand. As long as it can be invoked as $formatter --edition=2018 path/to/input.rs it would even work without any code change in cargo-expand, by setting a RUSTFMT environment variable to point to it.

match env::var_os("RUSTFMT") {