linebender / linebender/linebender.github.io

Tracking improvements to `group_imports`

Open
#87 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10
Forks
12
Avg merge
5d 6h
Merged PRs (30d)
1

Description

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](https://github.com/rust-lang/rustfmt/issues/5083#issuecomment-1951011779):

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

```rust
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:

```rust
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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rustfmt setting group_imports = "StdExternalCrate" and review the linked rustfmt tracking thread and its example output. Reproduce the current ordering, then verify that imports are sorted by visibility and item name as shown in the requested output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.