mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -05:00
remove unnecessary boilerplate
This commit is contained in:
parent
83c40c4f1a
commit
cb72235e2b
2 changed files with 6 additions and 14 deletions
|
@ -13,7 +13,6 @@ use image::codecs::jpeg::JpegDecoder;
|
|||
use image::codecs::png::PngDecoder;
|
||||
use image::codecs::webp::WebPDecoder;
|
||||
use image::DynamicImage;
|
||||
use image::ImageDecoder;
|
||||
use image::ImageError;
|
||||
|
||||
//
|
||||
|
@ -39,7 +38,6 @@ pub(crate) trait ImageDecoderFromReader<'a, R: BufRead + Seek> {
|
|||
self,
|
||||
error_fn: fn(ImageError) -> AnyError,
|
||||
) -> Result<DynamicImage, AnyError>;
|
||||
fn get_icc_profile(&mut self) -> Option<Vec<u8>>;
|
||||
}
|
||||
|
||||
pub(crate) type ImageDecoderFromReaderType<'a> = BufReader<Cursor<&'a [u8]>>;
|
||||
|
@ -68,12 +66,6 @@ macro_rules! impl_image_decoder_from_reader {
|
|||
Err(err) => Err(error_fn(err)),
|
||||
}
|
||||
}
|
||||
fn get_icc_profile(&mut self) -> Option<Vec<u8>> {
|
||||
match self.icc_profile() {
|
||||
Ok(profile) => profile,
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ fn decode_bitmap_data(
|
|||
image_decoding_error,
|
||||
)?;
|
||||
let orientation = decoder.orientation()?;
|
||||
let icc_profile = decoder.get_icc_profile();
|
||||
let icc_profile = decoder.icc_profile()?;
|
||||
(
|
||||
decoder.to_intermediate_image(image_decoding_error)?,
|
||||
orientation,
|
||||
|
@ -117,7 +117,7 @@ fn decode_bitmap_data(
|
|||
image_decoding_error,
|
||||
)?;
|
||||
let orientation = decoder.orientation()?;
|
||||
let icc_profile = decoder.get_icc_profile();
|
||||
let icc_profile = decoder.icc_profile()?;
|
||||
(
|
||||
decoder.to_intermediate_image(image_decoding_error)?,
|
||||
orientation,
|
||||
|
@ -131,7 +131,7 @@ fn decode_bitmap_data(
|
|||
image_decoding_error,
|
||||
)?;
|
||||
let orientation = decoder.orientation()?;
|
||||
let icc_profile = decoder.get_icc_profile();
|
||||
let icc_profile = decoder.icc_profile()?;
|
||||
(
|
||||
decoder.to_intermediate_image(image_decoding_error)?,
|
||||
orientation,
|
||||
|
@ -145,7 +145,7 @@ fn decode_bitmap_data(
|
|||
image_decoding_error,
|
||||
)?;
|
||||
let orientation = decoder.orientation()?;
|
||||
let icc_profile = decoder.get_icc_profile();
|
||||
let icc_profile = decoder.icc_profile()?;
|
||||
(
|
||||
decoder.to_intermediate_image(image_decoding_error)?,
|
||||
orientation,
|
||||
|
@ -159,7 +159,7 @@ fn decode_bitmap_data(
|
|||
image_decoding_error,
|
||||
)?;
|
||||
let orientation = decoder.orientation()?;
|
||||
let icc_profile = decoder.get_icc_profile();
|
||||
let icc_profile = decoder.icc_profile()?;
|
||||
(
|
||||
decoder.to_intermediate_image(image_decoding_error)?,
|
||||
orientation,
|
||||
|
@ -173,7 +173,7 @@ fn decode_bitmap_data(
|
|||
image_decoding_error,
|
||||
)?;
|
||||
let orientation = decoder.orientation()?;
|
||||
let icc_profile = decoder.get_icc_profile();
|
||||
let icc_profile = decoder.icc_profile()?;
|
||||
(
|
||||
decoder.to_intermediate_image(image_decoding_error)?,
|
||||
orientation,
|
||||
|
|
Loading…
Add table
Reference in a new issue