-
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
Open
decryphe
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
decryphe:source-ordering-improvements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/ui-toml/arbitrary_source_item_ordering/ord_within/clippy.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module-items-ordered-within-groups = true |
120 changes: 27 additions & 93 deletions
120
tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.default.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,226 +1,160 @@ | ||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:21:14 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:22:14 | ||
| | ||
LL | use std::rc::Weak; | ||
| ^^^^ | ||
| | ||
note: should be placed before `SNAKE_CASE` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:19:7 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:20:7 | ||
| | ||
LL | const SNAKE_CASE: &str = "zzzzzzzz"; | ||
| ^^^^^^^^^^ | ||
= note: `-D clippy::arbitrary-source-item-ordering` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::arbitrary_source_item_ordering)]` | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:64:1 | ||
| | ||
LL | / impl CloneSelf for StructOrdered { | ||
LL | | fn clone_self(&self) -> Self { | ||
LL | | Self { | ||
LL | | a: true, | ||
... | | ||
LL | | } | ||
LL | | } | ||
| |_^ | ||
| | ||
note: should be placed before the following item | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:54:1 | ||
| | ||
LL | / impl Default for StructOrdered { | ||
LL | | fn default() -> Self { | ||
LL | | Self { | ||
LL | | a: true, | ||
... | | ||
LL | | } | ||
LL | | } | ||
| |_^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:136:7 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:137:7 | ||
| | ||
LL | const ZIS_SHOULD_BE_REALLY_EARLY: () = (); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: should be placed before `TraitUnorderedItemKinds` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:124:7 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:125:7 | ||
| | ||
LL | trait TraitUnorderedItemKinds { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:151:1 | ||
| | ||
LL | impl BasicEmptyTrait for StructOrdered {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: should be placed before the following item | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:138:1 | ||
| | ||
LL | / impl TraitUnordered for StructUnordered { | ||
LL | | const A: bool = false; | ||
LL | | const C: bool = false; | ||
LL | | const B: bool = false; | ||
... | | ||
LL | | fn b() {} | ||
LL | | } | ||
| |_^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:170:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:171:5 | ||
| | ||
LL | mod this_is_in_the_wrong_position { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: should be placed before `main` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:165:4 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:166:4 | ||
| | ||
LL | fn main() { | ||
| ^^^^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:178:7 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:179:7 | ||
| | ||
LL | const ZIS_SHOULD_BE_EVEN_EARLIER: () = (); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: should be placed before `ZisShouldBeBeforeZeMainFn` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:176:8 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:177:8 | ||
| | ||
LL | struct ZisShouldBeBeforeZeMainFn; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:12:11 | ||
| | ||
LL | const AFTER: i8 = 0; | ||
| ^^^^^ | ||
| | ||
note: should be placed before `BEFORE` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:10:11 | ||
| | ||
LL | const BEFORE: i8 = 0; | ||
| ^^^^^^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:38:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:39:5 | ||
| | ||
LL | B, | ||
| ^ | ||
| | ||
note: should be placed before `C` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:37:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:38:5 | ||
| | ||
LL | C, | ||
| ^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:88:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:89:5 | ||
| | ||
LL | b: bool, | ||
| ^ | ||
| | ||
note: should be placed before `c` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:87:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:88:5 | ||
| | ||
LL | c: bool, | ||
| ^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:96:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:97:5 | ||
| | ||
LL | b: bool, | ||
| ^ | ||
| | ||
note: should be placed before `c` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:95:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:96:5 | ||
| | ||
LL | c: bool, | ||
| ^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:115:11 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:116:11 | ||
| | ||
LL | const B: bool; | ||
| ^ | ||
| | ||
note: should be placed before `C` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:114:11 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:115:11 | ||
| | ||
LL | const C: bool; | ||
| ^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:121:8 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:122:8 | ||
| | ||
LL | fn b(); | ||
| ^ | ||
| | ||
note: should be placed before `c` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:120:8 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:121:8 | ||
| | ||
LL | fn c(); | ||
| ^ | ||
|
||
error: incorrect ordering of trait items (defined order: [Const, Type, Fn]) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:127:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:128:5 | ||
| | ||
LL | const A: bool; | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
note: should be placed before `SomeType` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:125:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:126:5 | ||
| | ||
LL | type SomeType; | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:141:11 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:142:11 | ||
| | ||
LL | const B: bool = false; | ||
| ^ | ||
| | ||
note: should be placed before `C` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:140:11 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:141:11 | ||
| | ||
LL | const C: bool = false; | ||
| ^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:147:8 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:148:8 | ||
| | ||
LL | fn b() {} | ||
| ^ | ||
| | ||
note: should be placed before `c` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:146:8 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:147:8 | ||
| | ||
LL | fn c() {} | ||
| ^ | ||
|
||
error: incorrect ordering of impl items (defined order: [Const, Type, Fn]) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:156:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:157:5 | ||
| | ||
LL | const A: bool = false; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: should be placed before `SomeType` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:154:5 | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:155:5 | ||
| | ||
LL | type SomeType = (); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: incorrect ordering of items (must be alphabetically ordered) | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:172:11 | ||
| | ||
LL | const A: i8 = 1; | ||
| ^ | ||
| | ||
note: should be placed before `C` | ||
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:171:11 | ||
| | ||
LL | const C: i8 = 0; | ||
| ^ | ||
|
||
error: aborting due to 17 previous errors | ||
error: aborting due to 13 previous errors | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
I'll put some thought into this in the coming days.