fmt + clippy fixes

This commit is contained in:
Dr George Atkinson 2025-05-20 18:52:30 +01:00
parent 85228c1b37
commit 6327bc365b
7 changed files with 11 additions and 12 deletions

View file

@ -1,7 +1,7 @@
use crate::tiff::Ifd;
use crate::tiff::file::TiffRead;
use crate::tiff::tags::SonyDataOffset;
use crate::{RawImage, SubtractBlack, OrientationValue};
use crate::{OrientationValue, RawImage, SubtractBlack};
use bitstream_io::{BE, BitRead, BitReader, Endianness};
use std::io::{Read, Seek};

View file

@ -2,7 +2,7 @@ use crate::tiff::file::{Endian, TiffRead};
use crate::tiff::tags::{BitsPerSample, CfaPattern, CfaPatternDim, Compression, ImageLength, ImageWidth, SonyToneCurve, StripByteCounts, StripOffsets, Tag, WhiteBalanceRggbLevels};
use crate::tiff::values::{CompressionValue, CurveLookupTable};
use crate::tiff::{Ifd, TiffError};
use crate::{RawImage, SubtractBlack, OrientationValue};
use crate::{OrientationValue, RawImage, SubtractBlack};
use rawkit_proc_macros::Tag;
use std::io::{Read, Seek};

View file

@ -2,7 +2,7 @@ use crate::tiff::file::TiffRead;
use crate::tiff::tags::{BitsPerSample, BlackLevel, CfaPattern, CfaPatternDim, Compression, ImageLength, ImageWidth, RowsPerStrip, StripByteCounts, StripOffsets, Tag, WhiteBalanceRggbLevels};
use crate::tiff::values::CompressionValue;
use crate::tiff::{Ifd, TiffError};
use crate::{RawImage, SubtractBlack, OrientationValue};
use crate::{OrientationValue, RawImage, SubtractBlack};
use rawkit_proc_macros::Tag;
use std::io::{Read, Seek};

View file

@ -172,14 +172,13 @@ impl RawImage {
// Check the first two bytes to determine the format of the thumbnail.
// JPEG format starts with 0xFF, 0xD8.
if thumbnail_data[0..2] == [0xFF, 0xD8] {
return Ok(ThumbnailImage {
Ok(ThumbnailImage {
data: thumbnail_data,
format: ThumbnailFormat::Jpeg,
});
})
} else {
Err(DecoderError::UnsupportedThumbnailFormat)
}
}
/// Converts the [`RawImage`] to an [`Image`] with 8 bit resolution for each channel.

View file

@ -1,4 +1,4 @@
use crate::{Image, Pixel, OrientationValue};
use crate::{Image, OrientationValue, Pixel};
impl Image<u16> {
pub fn orientation_iter(&self) -> (usize, usize, impl Iterator<Item = Pixel> + use<'_>) {

View file

@ -1,5 +1,5 @@
use super::file::TiffRead;
use super::values::{CompressionValue, CurveLookupTable, Rational, OrientationValue};
use super::values::{CompressionValue, CurveLookupTable, OrientationValue, Rational};
use super::{Ifd, IfdTagType, TiffError};
use std::io::{Read, Seek};
@ -380,7 +380,7 @@ impl TagType for TypeOrientation {
type Output = OrientationValue;
fn read<R: Read + Seek>(file: &mut TiffRead<R>) -> Result<Self::Output, TiffError> {
Ok(OrientationValue::try_from(TypeShort::read(file)?).map_err(|_| TiffError::InvalidValue)?)
OrientationValue::try_from(TypeShort::read(file)?).map_err(|_| TiffError::InvalidValue)
}
}
@ -388,6 +388,6 @@ impl TagType for TypeCompression {
type Output = CompressionValue;
fn read<R: Read + Seek>(file: &mut TiffRead<R>) -> Result<Self::Output, TiffError> {
Ok(CompressionValue::try_from(TypeShort::read(file)?).map_err(|_| TiffError::InvalidValue)?)
CompressionValue::try_from(TypeShort::read(file)?).map_err(|_| TiffError::InvalidValue)
}
}
}

View file

@ -129,4 +129,4 @@ pub enum CompressionValue {
JPEG_XL = 52546,
Kodak_DCR_Compressed = 65000,
Pentax_PEF_Compressed = 65535,
}
}