@@ -117,8 +117,7 @@ fn baz() {}
117
117
In various cases, the default Rust style specifies to sort things. If not
118
118
otherwise specified, such sorting should be "version sorting", which ensures
119
119
that (for instance) ` x8 ` comes before ` x16 ` even though the character ` 1 ` comes
120
- before the character ` 8 ` . (If not otherwise specified, version-sorting is
121
- lexicographical.)
120
+ before the character ` 8 ` .
122
121
123
122
For the purposes of the Rust style, to compare two strings for version-sorting:
124
123
@@ -132,12 +131,13 @@ For the purposes of the Rust style, to compare two strings for version-sorting:
132
131
these strings, treat the chunks as equal (moving on to the next chunk) but
133
132
remember which string had more leading zeroes.
134
133
- To compare two chunks if both are not numeric, compare them by Unicode
135
- character lexicographically, except that ` _ ` (underscore) sorts immediately
136
- after ` ` (space) but before any other character. (This treats underscore as
137
- a word separator, as commonly used in identifiers.)
138
- - If the use of version sorting specifies further modifiers, such as sorting
139
- non-lowercase before lowercase, apply those modifiers to the lexicographic
140
- sort in this step.
134
+ character lexicographically, with two exceptions:
135
+ - ` _ ` (underscore) sorts immediately after ` ` (space) but before any other
136
+ character. (This treats underscore as a word separator, as commonly used in
137
+ identifiers.)
138
+ - Unless otherwise specified, version-sorting should sort non-lowercase
139
+ characters (characters that can start an ` UpperCamelCase ` identifier)
140
+ before lowercase characters.
141
141
- If the comparison reaches the end of the string and considers each pair of
142
142
chunks equal:
143
143
- If one of the numeric comparisons noted the earliest point at which one
@@ -157,7 +157,17 @@ leading zeroes.
157
157
158
158
As an example, version-sorting will sort the following strings in the order
159
159
given:
160
- - ` _ZYWX `
160
+ - ` _ZYXW `
161
+ - ` _abcd `
162
+ - ` A2 `
163
+ - ` ABCD `
164
+ - ` Z_YXW `
165
+ - ` ZY_XW `
166
+ - ` ZY_XW `
167
+ - ` ZYXW `
168
+ - ` ZYXW_ `
169
+ - ` a1 `
170
+ - ` abcd `
161
171
- ` u_zzz `
162
172
- ` u8 `
163
173
- ` u16 `
@@ -190,11 +200,7 @@ given:
190
200
- ` x86_64 `
191
201
- ` x86_128 `
192
202
- ` x87 `
193
- - ` Z_YWX `
194
- - ` ZY_WX `
195
- - ` ZYW_X `
196
- - ` ZYWX `
197
- - ` ZYWX_ `
203
+ - ` zyxw `
198
204
199
205
### [ Module-level items] ( items.md )
200
206
0 commit comments