Fix (clippy) warnings
This commit is contained in:
@@ -45,7 +45,7 @@ impl<'a> Bitreader<'a> {
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn bits_remaining(&mut self) -> Option<usize> {
|
||||
Some(self.reader.bits_remaining()?)
|
||||
self.reader.bits_remaining()
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn read_nbits(&mut self, n: u32) -> Result<u32, BitReadError> {
|
||||
@@ -54,16 +54,16 @@ impl<'a> Bitreader<'a> {
|
||||
}
|
||||
let b = self.peek(n);
|
||||
self.consume(n);
|
||||
return Ok(b as u32);
|
||||
Ok(b as u32)
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn read_u_bit_var(&mut self) -> Result<u32, BitReadError> {
|
||||
let bits = self.read_nbits(6)?;
|
||||
match bits & 0b110000 {
|
||||
0b10000 => return Ok((bits & 0b1111) | (self.read_nbits(4)? << 4)),
|
||||
0b100000 => return Ok((bits & 0b1111) | (self.read_nbits(8)? << 4)),
|
||||
0b110000 => return Ok((bits & 0b1111) | (self.read_nbits(28)? << 4)),
|
||||
_ => return Ok(bits),
|
||||
0b10000 => Ok((bits & 0b1111) | (self.read_nbits(4)? << 4)),
|
||||
0b100000 => Ok((bits & 0b1111) | (self.read_nbits(8)? << 4)),
|
||||
0b110000 => Ok((bits & 0b1111) | (self.read_nbits(28)? << 4)),
|
||||
_ => Ok(bits),
|
||||
}
|
||||
}
|
||||
#[inline(always)]
|
||||
@@ -73,7 +73,7 @@ impl<'a> Bitreader<'a> {
|
||||
if x & 1 != 0 {
|
||||
y = !y;
|
||||
}
|
||||
Ok(y as i32)
|
||||
Ok(y)
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn read_varint(&mut self) -> Result<u32, BitReadError> {
|
||||
@@ -160,18 +160,18 @@ impl<'a> Bitreader<'a> {
|
||||
}
|
||||
pub fn read_ubit_var_fp(&mut self) -> Result<u32, BitReadError> {
|
||||
if self.read_boolean()? {
|
||||
return Ok(self.read_nbits(2)?);
|
||||
return self.read_nbits(2);
|
||||
}
|
||||
if self.read_boolean()? {
|
||||
return Ok(self.read_nbits(4)?);
|
||||
return self.read_nbits(4);
|
||||
}
|
||||
if self.read_boolean()? {
|
||||
return Ok(self.read_nbits(10)?);
|
||||
return self.read_nbits(10);
|
||||
}
|
||||
if self.read_boolean()? {
|
||||
return Ok(self.read_nbits(17)?);
|
||||
return self.read_nbits(17);
|
||||
}
|
||||
return Ok(self.read_nbits(31)?);
|
||||
self.read_nbits(31)
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn read_bit_coord(&mut self) -> Result<f32, BitReadError> {
|
||||
@@ -190,7 +190,7 @@ impl<'a> Bitreader<'a> {
|
||||
frac_val = self.read_nbits(5)?;
|
||||
}
|
||||
let resol: f64 = 1.0 / (1 << 5) as f64;
|
||||
let result: f32 = (int_val as f64 + (frac_val as f64 * resol) as f64) as f32;
|
||||
let result: f32 = (int_val as f64 + (frac_val as f64 * resol)) as f32;
|
||||
if sign {
|
||||
Ok(-result)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user