-
Notifications
You must be signed in to change notification settings - Fork 97
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
refactor: group imports #251
Conversation
This commits adds a rustfmt configuration to create three import groups: 1. std, core 2. external 3. local crates and group all the imports based on these three groups. Changed `cargo fmt --all` to `cargo +nightly fmt --all` as this feature isn't stable Signed-off-by: jiaxiao zhou <[email protected]>
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.
I love this change! I didn't know you could configure rustfmt
like this.
Thanks @Mossaka !
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.
So much cleaner!
Question: do you all prefer imports granularity to be "crate" or "module", or something else? See https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#imports_granularity |
This commits adds a imports_granularity configuration to rustfmt.toml to merge imports from the same module into a single use statement. Signed-off-by: jiaxiao zhou <[email protected]>
Signed-off-by: jiaxiao zhou <[email protected]>
Module is fine for me. Either is fine actually. To me consistency is more important than what particular option we choose. |
I am going to merge this in. @jsturtevant any concerns on merging? For rebasing, I think the easier way is to copy the |
we will see how rebasing #238 will go, might make me 😢
💯 |
Merging it |
This commits adds a rustfmt configuration to create three import groups:
and group all the imports based on these three groups.
Changed
cargo fmt --all
tocargo +nightly fmt --all
as this feature isn't stable