-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using human/natural sort order #143
Comments
Agreed. We should use the |
Hm. Looking at the linked documentation
is my expectation correct that Also, what's the process here? Is anything needed before implementation and rustfmt PR? |
@tanriol it's likely that as an MVP, we should just do |
Would it be better to depend on some crate providing natural/version sort or to write an internal function for that? |
@tanriol I meant that as a general description of the algorithm. I would expect us to use 0-9 here for now, and I think we can implement the algorithm ourselves in Rust unless there's a crate handy that you already know of. |
Working on a PR and testing it, I'm seeing contradictions between actual tests and comment in them. Which ones should I follow? |
The PR is up as rust-lang/rustfmt#3764. |
Closing as I believe this issue has served its purposed. The Style Team agreed, decided upon a matching sort algorithm, set that as the default for Style Edition 2024 and beyond, and it's now been fully implemented within rustfmt (n.b. there's still an unstable option reorder_impl_items that needs to switch to this new algorithm, but all stable sorting formatting applies this new algorithm) |
Names used in libraries quite often contain numbers. In general, a sequence of digits in a name seems to be usually a number, not just a sequence of digits. However, rustfmt's sort order does not take that into account. For example, if I import several nom parsers for various integers, rustfmt suggests the following order
which feels really weird compared to
It would be great if the rustfmt sort order matched the natural expectations.
The text was updated successfully, but these errors were encountered: