Skip to content

Commit

Permalink
lint: clippy::cast_lossless and clippy::unreadable_literal lints
Browse files Browse the repository at this point in the history
  • Loading branch information
lopopolo authored and BurntSushi committed Nov 13, 2024
1 parent 65018f6 commit 955fa16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,11 @@ pub fn decode_last_lossy<B: AsRef<[u8]>>(slice: B) -> (char, usize) {
#[inline]
pub fn decode_step(state: &mut usize, cp: &mut u32, b: u8) {
let class = CLASSES[b as usize];
let b = u32::from(b);
if *state == ACCEPT {
*cp = (0xFF >> class) & (b as u32);
*cp = (0xFF >> class) & b;
} else {
*cp = (b as u32 & 0b111111) | (*cp << 6);
*cp = (b & 0b0011_1111) | (*cp << 6);
}
*state = STATES_FORWARD[*state + class as usize] as usize;
}
Expand Down

0 comments on commit 955fa16

Please sign in to comment.