-
Notifications
You must be signed in to change notification settings - Fork 20
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
Auto-format imports using Module
granularity
#702
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one suggestion about super::*
imports, but not blocking.
Part of #155
This is going to be a fun one 😆
I've pushed two preview commits: the first one imports using the
Crate
granularity, the other one withModule
granularity.Disclaimer: I'm biased 😃 I've used this style since I started using Rust and it's also being used by vast majority of projects in the ecosystem that I've used or looked at; it's also used by the Rust compiler, Cargo and the tools like Rustfmt or Clippy.
Here's a summary of the possible options: rust-lang/rustfmt#3362.
Here is an RFC discussion about setting on a variant: rust-lang/style-team#140, I highly recommend reading it.
To give a brief summary, it seems that people stand behind two options:
Module
- good trade-off between readability and concisenessItem
- minimizes conflicts when many people edit the same files oftenTo bring back some of the arguments raised in favor of the
Module
and explain some of my reasoning as well:Item
) imports, which can often explode and take unreasonable amount of space (and we don't really benefit enough from minimized conflicts as we probably won't be a team of 50 or the like)...crate
-style use import tree...grep
pability