Skip to content

More advanced group_imports with 4 groups and adaptable "std-like" crates #5550

Open
@DrSloth

Description

@DrSloth

In code i write i have taken to group the import statements into 4 groups:

  1. "std-like" crates which include all the normal std crates (std, alloc, core) and large crates like tokio or frameworks like axum or bevy pretty much everything which fundamentaly controls how my code will look like.
  2. Other external crates
  3. Workspace internal crates
  4. Crate internal imports

I have thought about trying to implement this in rustfmt, but i don't know how doable this is.
I guess making crates in 1. optionally configurable shouldn't be that hard, but does rustfmt get any workspace information? Is it feasible to optionally implement retrieving workspace information for such a feature, or would this require some larger architectural/conceptual change?

Thanks in advance :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions