@@ -117,8 +117,7 @@ fn baz() {}
117117In various cases, the default Rust style specifies to sort things. If not
118118otherwise specified, such sorting should be "version sorting", which ensures
119119that (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 ` .
122121
123122For the purposes of the Rust style, to compare two strings for version-sorting:
124123
@@ -132,12 +131,13 @@ For the purposes of the Rust style, to compare two strings for version-sorting:
132131 these strings, treat the chunks as equal (moving on to the next chunk) but
133132 remember which string had more leading zeroes.
134133- 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.
141141- If the comparison reaches the end of the string and considers each pair of
142142 chunks equal:
143143 - If one of the numeric comparisons noted the earliest point at which one
@@ -157,7 +157,17 @@ leading zeroes.
157157
158158As an example, version-sorting will sort the following strings in the order
159159given:
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 `
161171- ` u_zzz `
162172- ` u8 `
163173- ` u16 `
@@ -190,11 +200,7 @@ given:
190200- ` x86_64 `
191201- ` x86_128 `
192202- ` x87 `
193- - ` Z_YWX `
194- - ` ZY_WX `
195- - ` ZYW_X `
196- - ` ZYWX `
197- - ` ZYWX_ `
203+ - ` zyxw `
198204
199205### [ Module-level items] ( items.md )
200206
0 commit comments