Sort mod, use, pub use, const, static, type, and extern crate items at the top of files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Rust source files typically have various items at the top of the file, including:
moduse(pub useis often grouped together withmod)extern crate(predominantly in Rust 2015)typeconststaticmacro_rules!
There's a lot of inconsistency about the order of these items, so it would be great to have a sensible system enforced by rustfmt.
Many of these items (mod, use, type, const, static) can be marked public, and mod statements can have their contents specified inline (mod module_name { /* items */ }). These factors should potentially influence the item order.
I am not sure if there has been research before about which order makes the most sense, or has the most adoption in the community. If there is, that could be a good starting point to decide on the rustfmt-enforced order.
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
No files, tests, or entry points are named. Start by researching community conventions for ordering mod, use, extern crate, type, const, static, and macro_rules! items, including visibility and inline modules; done means rustfmt applies an agreed, consistent order.
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
- Needs clarification
- Newbie friendliness
- 25/100