Fix a few clippy warnings

This commit is contained in:
Ivan Smirnov 2022-01-03 14:30:37 +03:00
parent 12147521f2
commit 45bed0445d
2 changed files with 2 additions and 1 deletions

View file

@ -81,7 +81,7 @@ where
if unlikely(data.len() < QOI_PADDING_SIZE) { if unlikely(data.len() < QOI_PADDING_SIZE) {
return Err(Error::UnexpectedBufferEnd); return Err(Error::UnexpectedBufferEnd);
} else if unlikely(&data[..QOI_PADDING_SIZE] != &QOI_PADDING) { } else if unlikely(data[..QOI_PADDING_SIZE] != QOI_PADDING) {
return Err(Error::InvalidPadding); return Err(Error::InvalidPadding);
} }

View file

@ -88,6 +88,7 @@ pub struct QoiEncoder<'a> {
impl<'a> QoiEncoder<'a> { impl<'a> QoiEncoder<'a> {
#[inline] #[inline]
#[allow(clippy::cast_possible_truncation)]
pub fn new(data: &'a (impl AsRef<[u8]> + ?Sized), width: u32, height: u32) -> Result<Self> { pub fn new(data: &'a (impl AsRef<[u8]> + ?Sized), width: u32, height: u32) -> Result<Self> {
let data = data.as_ref(); let data = data.as_ref();
let mut header = let mut header =