-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make imports consistent. #94
Conversation
77664ab
to
85ab151
Compare
The order of imports isn't something I'm very concerned with tbh. The one used today is the rustfmt's default. Can you configure rustfmt to use this ordering? |
It seems rustfmt has an Until rustfmt stable is able to automatically format imports the way we want I'm reluctant to change the formatting as it creates churn and will not be maintained unless done automatically. Do you know of a way to maintain this style automatically? |
rustfmt can't do this automatically, I did it manually, but I saw other projects do it, which seems more clear. 😁 |
In that case I think we should wait with this. Even though I'm sorry for discarding all this tedious manual work 😕 The order used now is the default ordering used by rustfmt when all the imports are in one block (no newlines between) so at least that gives some consistency. |
I respect your decision. 😁 |
What I've done in a bunch of projects before is have one Stable CI job that runs |
What do you do for running rustfmt locally then? Override it to use nightly somehow? |
Well stable rustfmt still applies all non-experimental formatting options for me and with the codebase being consistently formatted I hardly ever accidentally introduce something that nightly rustfmt would format differently. Occasionally I might |
The |
@ZhangHanDong What do you mean by that? I'm aware of two bugs affecting |
What I mean is that relying on The only option currently available for
https://rust-lang.github.io/rustfmt/?#group_imports But wouldn't external crates have to be manually grouped by the developer? |
Not sure what additional grouping of external crates you're talking about. From a quick glance at this PR it seems like it implements exactly what rustfmt would do too with |
@jplatte You'll understand if you look at the changes in this pr.
Does this make it clear? |
But why do you think that the previous version would be preferred? I was under the impression that @davidpdrsn was agreeing with changing things in the way that this PR does, but that the churn is not worth it if it can't be enforced in the future. |
I don't know if this is a coding style standard, but I know that many popular projects use this import order. 😁