Skip to content

Commit 76c9947

Browse files
committed
a bit more usize::from
1 parent 4d0f7e2 commit 76c9947

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/core/src/escape.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ pub(crate) fn escape_ascii_into(output: &mut [u8; 4], byte: u8) -> Range<u8> {
1717
b'"' => ([b'\\', b'"', 0, 0], 2),
1818
b'\x20'..=b'\x7e' => ([byte, 0, 0, 0], 1),
1919
_ => {
20-
([b'\\', b'x', HEX_DIGITS[(byte >> 4) as usize], HEX_DIGITS[(byte & 0xf) as usize]], 4)
20+
let hi = HEX_DIGITS[usize::from(byte >> 4)];
21+
let lo = HEX_DIGITS[usize::from(byte & 0xf)];
22+
([b'\\', b'x', hi, lo], 4)
2123
}
2224
};
2325
*output = data;

0 commit comments

Comments
 (0)