mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 13:18:11 +08:00
Fix a lot of Clippy warnings (#1808)
* fix a lot of clippy warnings * fix more clippy warnings * fix yet more clippy warnings * bump msrv to 1.70.0 to silence warnings * fix a lot of clippy warnings * fix more clippy warnings * fix yet more clippy warnings * fix a few more warnings * fix a clippy warning * remove a commented out line * silense too many arguments error * fix more clippy warnings * prefix underscore to unused vars/functions to fix warnings * use filter instead of map * move raw-rs-tests feature flat to module level to fix unused imports warnings * fix a couple of unused result warnings --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
f7ada701e5
commit
62f73df048
@@ -30,7 +30,7 @@ pub fn decode<R: Read + Seek>(ifd: Ifd, file: &mut TiffRead<R>) -> RawImage {
|
||||
|
||||
let image_width: usize = ifd.image_width.try_into().unwrap();
|
||||
let image_height: usize = ifd.image_height.try_into().unwrap();
|
||||
let bits_per_sample: usize = ifd.bits_per_sample.into();
|
||||
let _bits_per_sample: usize = ifd.bits_per_sample.into();
|
||||
let [cfa_pattern_width, cfa_pattern_height] = ifd.cfa_pattern_dim;
|
||||
assert!(cfa_pattern_width == 2 && cfa_pattern_height == 2);
|
||||
|
||||
@@ -81,10 +81,10 @@ fn sony_arw2_load_raw<R: Read + Seek>(width: usize, height: usize, curve: CurveL
|
||||
let max_minus_min = max as i32 - min as i32;
|
||||
let shift_by_bits = (0..4).find(|&shift| (0x80 << shift) > max_minus_min).unwrap_or(4);
|
||||
|
||||
let mut pixel = [0_u16; 16];
|
||||
let mut pixels = [0_u16; 16];
|
||||
let mut bit = 30;
|
||||
for i in 0..16 {
|
||||
pixel[i] = match () {
|
||||
for (i, pixel) in pixels.iter_mut().enumerate() {
|
||||
*pixel = match () {
|
||||
_ if i as u32 == index_to_set_max => max,
|
||||
_ if i as u32 == index_to_set_min => min,
|
||||
_ => {
|
||||
@@ -98,7 +98,7 @@ fn sony_arw2_load_raw<R: Read + Seek>(width: usize, height: usize, curve: CurveL
|
||||
};
|
||||
}
|
||||
|
||||
for value in pixel {
|
||||
for value in pixels {
|
||||
image[row * width + column] = curve.get((value << 1).into()) >> 2;
|
||||
|
||||
// Skip between interlaced columns
|
||||
|
||||
@@ -29,7 +29,7 @@ pub fn decode<R: Read + Seek>(ifd: Ifd, file: &mut TiffRead<R>) -> RawImage {
|
||||
let image_width: usize = ifd.image_width.try_into().unwrap();
|
||||
let image_height: usize = ifd.image_height.try_into().unwrap();
|
||||
let rows_per_strip: usize = ifd.rows_per_strip.try_into().unwrap();
|
||||
let bits_per_sample: usize = ifd.bits_per_sample.into();
|
||||
let _bits_per_sample: usize = ifd.bits_per_sample.into();
|
||||
let [cfa_pattern_width, cfa_pattern_height] = ifd.cfa_pattern_dim;
|
||||
assert!(cfa_pattern_width == 2 && cfa_pattern_height == 2);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ impl Ifd {
|
||||
})
|
||||
}
|
||||
|
||||
fn next_ifd<R: Read + Seek>(&self, file: &mut TiffRead<R>) -> Result<Self, TiffError> {
|
||||
fn _next_ifd<R: Read + Seek>(&self, file: &mut TiffRead<R>) -> Result<Self, TiffError> {
|
||||
Ifd::new_from_offset(file, self.next_ifd_offset.unwrap_or(0))
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ impl PrimitiveType for TypeIfd {
|
||||
|
||||
fn read_primitive<R: Read + Seek>(the_type: IfdTagType, file: &mut TiffRead<R>) -> Result<Self::Output, TiffError> {
|
||||
let offset = TypeLong::read_primitive(the_type, file)?;
|
||||
Ok(Ifd::new_from_offset(file, offset)?)
|
||||
Ifd::new_from_offset(file, offset)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ impl<T: PrimitiveType> TagType for T {
|
||||
type Output = T::Output;
|
||||
|
||||
fn read<R: Read + Seek>(file: &mut TiffRead<R>) -> Result<Self::Output, TiffError> {
|
||||
let the_type = IfdTagType::try_from(file.read_u16()?).map_err(|_| TiffError::InvalidType)?;
|
||||
let the_type = IfdTagType::from(file.read_u16()?);
|
||||
let count = file.read_u32()?;
|
||||
|
||||
if count != 1 {
|
||||
@@ -313,7 +313,7 @@ impl<T: PrimitiveType> TagType for Array<T> {
|
||||
type Output = Vec<T::Output>;
|
||||
|
||||
fn read<R: Read + Seek>(file: &mut TiffRead<R>) -> Result<Self::Output, TiffError> {
|
||||
let the_type = IfdTagType::try_from(file.read_u16()?).map_err(|_| TiffError::InvalidType)?;
|
||||
let the_type = IfdTagType::from(file.read_u16()?);
|
||||
let count = file.read_u32()?;
|
||||
|
||||
let size = T::get_size(the_type).ok_or(TiffError::InvalidType)?;
|
||||
@@ -334,7 +334,7 @@ impl<T: PrimitiveType, const N: usize> TagType for ConstArray<T, N> {
|
||||
type Output = [T::Output; N];
|
||||
|
||||
fn read<R: Read + Seek>(file: &mut TiffRead<R>) -> Result<Self::Output, TiffError> {
|
||||
let the_type = IfdTagType::try_from(file.read_u16()?).map_err(|_| TiffError::InvalidType)?;
|
||||
let the_type = IfdTagType::from(file.read_u16()?);
|
||||
let count = file.read_u32()?;
|
||||
|
||||
if count != N.try_into()? {
|
||||
|
||||
Reference in New Issue
Block a user