`use` imports are wrapped unless double-nested imports are present
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
rustfmt gives this:
use {
fidl_fuchsia_hardware_ethernet_ext::EthernetQueueFlags, futures::TryStreamExt, std::fs::File,
structopt::StructOpt,
};
which is, IMO, pretty gross as it mixes imports from many different crates all together onto the same line.
Adding a group after _ext:: and adding Bar to it gives this:
use {
fidl_fuchsia_hardware_ethernet_ext::{Bar, EthernetQueueFlags},
futures::TryStreamExt,
std::fs::File,
structopt::StructOpt,
};
which is more like what I would expect. What's going on here? Is there a setting that can be enabled to always get the bottom layout, even when no nested groups are present?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two import examples from the issue and inspect rustfmt's import-formatting behavior and available configuration options. Determine whether an existing setting can produce the grouped layout, or define the behavior needed for a new option; done means imports from separate crates remain on separate lines without requiring a nested group.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100