[short-hex-str] Disable clippy arithmetic overflow lints with comments
Closes:
@@ -82,6 +82,7 @@ const HEX_CHARS_LOWER: &[u8; 16] = b"0123456789abcdef";
/// the second character as ASCII bytes.
#[inline(always)]
fn byte2hex(byte: u8) -> (u8, u8) {
+ #[allow(clippy::integer_arithmetic)] // X >> 4 is valid for all bytes
let hi = HEX_CHARS_LOWER[((byte >> 4) & 0x0f) as usize];
let lo = HEX_CHARS_LOWER[(byte & 0x0f) as usize];
(hi, lo)
@@ -89,6 +90,7 @@ fn byte2hex(byte: u8) -> (u8, u8) {
/// Hex encode a byte slice into the destination byte slice.
#[inline(always)]
+#[allow(clippy::integer_arithmetic)] // debug only assertion
fn hex_encode(src: &[u8], dst: &mut [u8]) {
debug_checked_precondition!(dst.len() == 2 * src.len());
