-
Notifications
You must be signed in to change notification settings - Fork 685
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
Unify imports at the top of a file #2081
Comments
On the client side, in some files there is a pattern where crate, external and std imports are in their own blocks. I think that's preferable to clumping everything in one block but since there's no guideline, it's not as consistent as it could perhaps be. |
Yeah, we should come up with some kind of consistent way for doing this and then putting it into the |
I often see this in some runtime files, where the imports are spread over multiple blocks. The criteria to how these blocks were formed or the logic behind it is not documented and makes it impossible for
cargo fmt
to remove duplicated or for the developer to find things:polkadot-sdk/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Lines 46 to 59 in f6560c2
I think it would be smart to not split the imports with a newline, but have them all in one block.
The only exception would be feature gated imports. As structure i propose:
Note that this will cause huge merge conflicts with existing MRs, so please check what MRs are affected first.
The text was updated successfully, but these errors were encountered: