Skip to content

Commit

Permalink
fix: fixed clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SalOne22 committed Mar 15, 2024
1 parent 7d3fa3b commit b2b7f79
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 36 deletions.
15 changes: 3 additions & 12 deletions src/codecs/avif/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct AvifOptions {
}

/// A AVIF encoder
#[derive(Default)]
pub struct AvifEncoder {
options: AvifOptions,
}
Expand All @@ -33,14 +34,6 @@ impl Default for AvifOptions {
}
}

impl Default for AvifEncoder {
fn default() -> Self {
Self {
options: Default::default(),
}
}
}

impl AvifEncoder {
/// Create a new encoder
pub fn new() -> AvifEncoder {
Expand Down Expand Up @@ -104,10 +97,8 @@ impl EncoderTrait for AvifEncoder {
&[BitDepth::Eight]
}

fn default_depth(&self, depth: BitDepth) -> BitDepth {
match depth {
_ => BitDepth::Eight,
}
fn default_depth(&self, _depth: BitDepth) -> BitDepth {
BitDepth::Eight
}
}

Expand Down
11 changes: 2 additions & 9 deletions src/codecs/mozjpeg/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct MozJpegOptions {
}

/// A MozJpeg encoder
#[derive(Default)]
pub struct MozJpegEncoder {
options: MozJpegOptions,
}
Expand All @@ -38,14 +39,6 @@ impl Default for MozJpegOptions {
}
}

impl Default for MozJpegEncoder {
fn default() -> Self {
Self {
options: Default::default(),
}
}
}

impl MozJpegEncoder {
/// Create a new encoder
pub fn new() -> MozJpegEncoder {
Expand Down Expand Up @@ -128,7 +121,7 @@ impl EncoderTrait for MozJpegEncoder {

let mut comp = comp.start_compress(Vec::new())?;

comp.write_scanlines(&data)?;
comp.write_scanlines(data)?;

Ok(comp.finish()?)
})
Expand Down
9 changes: 1 addition & 8 deletions src/codecs/oxipng/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ use zune_image::{
pub type OxiPngOptions = oxipng::Options;

/// A OxiPNG encoder
#[derive(Default)]
pub struct OxiPngEncoder {
options: OxiPngOptions,
}

impl Default for OxiPngEncoder {
fn default() -> Self {
Self {
options: Default::default(),
}
}
}

impl OxiPngEncoder {
/// Create a new encoder
pub fn new() -> OxiPngEncoder {
Expand Down
4 changes: 1 addition & 3 deletions src/codecs/webp/decoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ impl<R: Read> WebPDecoder<R> {
source.read_to_end(&mut buf)?;

let decoder = AnimDecoder::new(&buf);
let img = decoder
.decode()
.map_err(|e| ImageErrors::ImageDecodeErrors(e))?;
let img = decoder.decode().map_err(ImageErrors::ImageDecodeErrors)?;

Ok(WebPDecoder {
inner: img,
Expand Down
6 changes: 2 additions & 4 deletions src/codecs/webp/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ impl EncoderTrait for WebPEncoder {
&[BitDepth::Eight]
}

fn default_depth(&self, depth: BitDepth) -> BitDepth {
match depth {
_ => BitDepth::Eight,
}
fn default_depth(&self, _depth: BitDepth) -> BitDepth {
BitDepth::Eight
}

fn supports_animated_images(&self) -> bool {
Expand Down

0 comments on commit b2b7f79

Please sign in to comment.