Group use vs mod statements
Open
Nobody has claimed this yet.
A-imports
C-feature-request
P-low
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Consider the following:
use std::borrow::Cow;
use std::alloc::GlobalAlloc;
pub mod baz;
use std::cell::Cell;
use std::ascii::AsciiExt;
When running rustfmt, this sorts the use statements alphabetically, but leaves the mod in place:
use std::alloc::GlobalAlloc;
use std::borrow::Cow;
pub mod baz;
use std::ascii::AsciiExt;
use std::cell::Cell;
- Is there an established convention for whether all
modstatements should go above or below alluse? - If so, is there a way to enforce that in rustfmt?
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 running rustfmt on the Rust snippet in the issue and comparing how it orders the use and mod statements. Determine whether the project has an established ordering convention, then check whether rustfmt exposes a relevant configuration or entry point. Done means the convention is documented or the requested ordering can be consistently enforced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100