-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
arbitrary_source_item_ordering
: Make alphabetic ordering in module item groups optional
#13718
base: master
Are you sure you want to change the base?
Conversation
…ult: off) From feedback to this lint after its inclusion in clippy 1.82, this has turned out to be the most requested improvement. With this improvement, it is possible to make the lint check certain top-level structural checks on modules (e.g. use statements and module inclusions at the top), but still leaving everything else up to the developer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wait, this change looks good to me. I have one question but it's not a blocker (although it would be good to decide now so we wouldn't need to change the behavior of this configuration later and break users)
@@ -676,6 +676,16 @@ The named groupings of different source item kinds within modules. | |||
* [`arbitrary_source_item_ordering`](https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering) | |||
|
|||
|
|||
## `module-items-ordered-within-groups` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense for this configuration to accept an array of group names similar to how source-item-ordering
lets you configure it for specific kinds of items and default to an empty array? Or do you think that's not needed and a simple boolean is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mostly thinking that the config is getting convoluted in either case, but I fully agree that it would make sense to go for higher granularity here. I would like to have an option for "all", but would need to investigate how to best express that in TOML.
Preferrably I'd have the options of:
module-items-ordered-within-groups = "none" (being the default)
module-items-ordered-within-groups = ["mod", "use", "my_custom_group", ...]
module-items-ordered-within-groups = "all"
I'll put some thought into this in the coming days.
From feedback to the
arbitrary_source_item_ordering
lint after its inclusion in clippy 1.82, making alphabetic ordering within module item groups has turned out to be the most requested improvement. With this improvement, it is possible to make the lint perform certain top-level structural checks on modules (e.g. use statements and module inclusions at the top), but still leaving everything else up to the developer.Implements parts of the suggestions from #13675. A catch-all-group is still to be implemented.
changelog: [
arbitrary_source_item_ordering
]: Make alphabetic ordering in module item groups optional (off by default)