Skip to content

Commit 41950c6

Browse files
committed
Explain the order of the enumeration items
Simply a micro-optimization to reduce code size and to open up inlining opportunities.
1 parent da03950 commit 41950c6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libcore/char.rs

+3
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ pub struct EscapeUnicode {
411411
hex_digit_idx: usize,
412412
}
413413

414+
// The enum values are ordered so that their representation is the
415+
// same as the remaining length (besides the hexadecimal digits). This
416+
// likely makes `len()` a single load from memory) and inline-worth.
414417
#[derive(Clone, Debug)]
415418
enum EscapeUnicodeState {
416419
Done,

0 commit comments

Comments
 (0)