Skip to content

Tracking improvements to group_imports #87

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

Open
xStrom opened this issue Jan 23, 2025 · 1 comment
Open

Tracking improvements to group_imports #87

xStrom opened this issue Jan 23, 2025 · 1 comment

Comments

@xStrom
Copy link
Member

xStrom commented Jan 23, 2025

We would like to use the rustfmt setting group_imports = "StdExternalCrate".

The problem with it is that it mixes different visibility cases. As mentioned in the tracking thread:

At the moment, it produces the following kinds of use lists:

use a;
pub(crate) use b;
pub use c;
use d;
pub use x;
pub(crate) use z;

whereas it feels more natural for the sort order to be:

pub use c;
pub use x;
pub(crate) use b;
pub(crate) use z;
use a;
use d;

That is, sort by visibility then by item name.

@DJMcNab
Copy link
Member

DJMcNab commented Jan 23, 2025

I'd probably also want those groups to be seperated with blank lines (and I'd probably advocate for the order to be the other way around (so that the public API doesn't have imports in the middle of it).

But agreed, we should work with upstream to improve this.

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

No branches or pull requests

2 participants