Use Unicode string comparison for sortable identifiers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Rust supports Unicode identifiers (https://rust-lang.github.io/rfcs/2457-non-ascii-idents.html). I think it would make sense for rustfmt to sort identifiers according to Unicode collation rather than Unicode codepoint ordering.
The following code:
use example::{e, é, f};
Is formatted like this:
use example::{e, f, é};
As é is later in Unicode than f.
I think it would make sense to for it to be ordered like {e, é, f}.
Different languages have different collations. It would useful for rustfmt to provide an option to configure locale with a default setting und (which is good enough for most languages).
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 examining rustfmt's current identifier-sorting behavior and the linked Unicode identifiers RFC. Define how configurable locale collation, including the default und setting, should affect the example import ordering; done means the behavior and configuration are specified and verified for Unicode identifiers.
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