Skip to content

Commit

Permalink
a bit more usize::from
Browse files Browse the repository at this point in the history
  • Loading branch information
mina86 committed Apr 30, 2023
1 parent 4d0f7e2 commit 76c9947
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/core/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ pub(crate) fn escape_ascii_into(output: &mut [u8; 4], byte: u8) -> Range<u8> {
b'"' => ([b'\\', b'"', 0, 0], 2),
b'\x20'..=b'\x7e' => ([byte, 0, 0, 0], 1),
_ => {
([b'\\', b'x', HEX_DIGITS[(byte >> 4) as usize], HEX_DIGITS[(byte & 0xf) as usize]], 4)
let hi = HEX_DIGITS[usize::from(byte >> 4)];
let lo = HEX_DIGITS[usize::from(byte & 0xf)];
([b'\\', b'x', hi, lo], 4)
}
};
*output = data;
Expand Down

0 comments on commit 76c9947

Please sign in to comment.