Skip to content

Conversation

@Mossaka
Copy link
Member

@Mossaka Mossaka commented Aug 18, 2023

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

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 <jiazho@microsoft.com>
Copy link
Collaborator

@jprendes jprendes left a 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 !

devigned
devigned previously approved these changes Aug 18, 2023
Copy link
Contributor

@devigned devigned left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much cleaner!

@Mossaka
Copy link
Member Author

Mossaka commented Aug 18, 2023

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 <jiazho@microsoft.com>
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
@jprendes
Copy link
Collaborator

jprendes commented Aug 18, 2023

Question: do you all prefer imports granularity to be "crate" or "module", or something else?

Module is fine for me. Either is fine actually. To me consistency is more important than what particular option we choose.

@Mossaka
Copy link
Member Author

Mossaka commented Aug 18, 2023

I am going to merge this in. @jsturtevant any concerns on merging? For rebasing, I think the easier way is to copy the rustfmt.toml file and then ran cargo +nightly fmt --all before rebasing this PR.

@jsturtevant
Copy link
Contributor

we will see how rebasing #238 will go, might make me 😢

To me consistency is more important than what particular option we choose.

💯

@Mossaka
Copy link
Member Author

Mossaka commented Aug 20, 2023

Merging it

@Mossaka Mossaka merged commit 52e55cf into containerd:main Aug 20, 2023
@Mossaka Mossaka deleted the group-imports branch August 20, 2023 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants