diff --git a/src/read.rs b/src/read.rs index eaa46996b..b4128467b 100644 --- a/src/read.rs +++ b/src/read.rs @@ -960,7 +960,7 @@ fn parse_unicode_escape<'de, R: Read<'de>>( // This value is in range U+10000..=U+10FFFF, which is always a valid // codepoint. - let n = (((n1 - 0xD800) as u32) << 10 | (n2 - 0xDC00) as u32) + 0x1_0000; + let n = ((((n1 - 0xD800) as u32) << 10) | (n2 - 0xDC00) as u32) + 0x1_0000; push_wtf8_codepoint(n, scratch); return Ok(()); } @@ -988,19 +988,21 @@ fn push_wtf8_codepoint(n: u32, scratch: &mut Vec) { let encoded_len = match n { 0..=0x7F => unreachable!(), 0x80..=0x7FF => { - ptr.write((n >> 6 & 0b0001_1111) as u8 | 0b1100_0000); + ptr.write(((n >> 6) & 0b0001_1111) as u8 | 0b1100_0000); 2 } 0x800..=0xFFFF => { - ptr.write((n >> 12 & 0b0000_1111) as u8 | 0b1110_0000); - ptr.add(1).write((n >> 6 & 0b0011_1111) as u8 | 0b1000_0000); + ptr.write(((n >> 12) & 0b0000_1111) as u8 | 0b1110_0000); + ptr.add(1) + .write(((n >> 6) & 0b0011_1111) as u8 | 0b1000_0000); 3 } 0x1_0000..=0x10_FFFF => { - ptr.write((n >> 18 & 0b0000_0111) as u8 | 0b1111_0000); + ptr.write(((n >> 18) & 0b0000_0111) as u8 | 0b1111_0000); ptr.add(1) - .write((n >> 12 & 0b0011_1111) as u8 | 0b1000_0000); - ptr.add(2).write((n >> 6 & 0b0011_1111) as u8 | 0b1000_0000); + .write(((n >> 12) & 0b0011_1111) as u8 | 0b1000_0000); + ptr.add(2) + .write(((n >> 6) & 0b0011_1111) as u8 | 0b1000_0000); 4 } 0x11_0000.. => unreachable!(),