Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing clippy warnings #1702

Merged
merged 1 commit into from Apr 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/codecs/dds.rs
Expand Up @@ -81,15 +81,15 @@ impl error::Error for DecoderError {}
/// Header used by DDS image files
#[derive(Debug)]
struct Header {
flags: u32,
_flags: u32,
height: u32,
width: u32,
pitch_or_linear_size: u32,
depth: u32,
mipmap_count: u32,
_pitch_or_linear_size: u32,
_depth: u32,
_mipmap_count: u32,
pixel_format: PixelFormat,
caps: u32,
caps2: u32,
_caps: u32,
_caps2: u32,
}

/// Extended DX10 header used by some DDS image files
Expand All @@ -107,11 +107,11 @@ struct DX10Header {
struct PixelFormat {
flags: u32,
fourcc: [u8; 4],
rgb_bit_count: u32,
r_bit_mask: u32,
g_bit_mask: u32,
b_bit_mask: u32,
a_bit_mask: u32,
_rgb_bit_count: u32,
_r_bit_mask: u32,
_g_bit_mask: u32,
_b_bit_mask: u32,
_a_bit_mask: u32,
}

impl PixelFormat {
Expand All @@ -128,11 +128,11 @@ impl PixelFormat {
r.read_exact(&mut v)?;
v
},
rgb_bit_count: r.read_u32::<LittleEndian>()?,
r_bit_mask: r.read_u32::<LittleEndian>()?,
g_bit_mask: r.read_u32::<LittleEndian>()?,
b_bit_mask: r.read_u32::<LittleEndian>()?,
a_bit_mask: r.read_u32::<LittleEndian>()?,
_rgb_bit_count: r.read_u32::<LittleEndian>()?,
_r_bit_mask: r.read_u32::<LittleEndian>()?,
_g_bit_mask: r.read_u32::<LittleEndian>()?,
_b_bit_mask: r.read_u32::<LittleEndian>()?,
_a_bit_mask: r.read_u32::<LittleEndian>()?,
})
}
}
Expand Down Expand Up @@ -171,15 +171,15 @@ impl Header {
}

Ok(Self {
flags,
_flags: flags,
height,
width,
pitch_or_linear_size,
depth,
mipmap_count,
_pitch_or_linear_size: pitch_or_linear_size,
_depth: depth,
_mipmap_count: mipmap_count,
pixel_format,
caps,
caps2,
_caps: caps,
_caps2: caps2,
})
}
}
Expand All @@ -206,7 +206,7 @@ impl DX10Header {

fn validate(&self) -> Result<(), ImageError> {
// Note: see https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dds-header-dxt10 for info on valid values
if self.dxgi_format < 0 || self.dxgi_format > 132 {
if self.dxgi_format > 132 {
// Invalid format
return Err(DecoderError::DxgiFormatInvalid(self.dxgi_format).into());
}
Expand All @@ -229,7 +229,7 @@ impl DX10Header {
return Err(DecoderError::Dx10ArraySizeInvalid(self.array_size).into());
}

if self.misc_flags_2 < 0x0 || self.misc_flags_2 > 0x4 {
if self.misc_flags_2 > 0x4 {
// Invalid alpha flags
return Err(DecoderError::Dx10FlagsInvalid(self.misc_flags_2).into());
}
Expand Down
4 changes: 2 additions & 2 deletions src/codecs/webp/lossless.rs
Expand Up @@ -377,7 +377,7 @@ impl<R: Read> LosslessDecoder<R> {

let info = HuffmanInfo {
xsize: huffman_xsize,
ysize: huffman_ysize,
_ysize: huffman_ysize,
color_cache,
image: entropy_image,
bits: huffman_bits,
Expand Down Expand Up @@ -630,7 +630,7 @@ impl<R: Read> LosslessDecoder<R> {
#[derive(Debug, Clone)]
struct HuffmanInfo {
xsize: u16,
ysize: u16,
_ysize: u16,
color_cache: Option<ColorCache>,
image: Vec<u32>,
bits: u8,
Expand Down