Skip to content

Commit

Permalink
zune: Fix clippy errors
Browse files Browse the repository at this point in the history
Signed-off-by: caleb <[email protected]>
  • Loading branch information
etemesi254 committed Aug 15, 2023
1 parent 15fbd80 commit 957e5fd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions zune-benches/benches/decode_jpeg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn decode_hv_samp(c: &mut Criterion) {
fn decode_jpeg_grayscale(buf: &[u8]) -> Vec<u8> {
let options = DecoderOptions::default().jpeg_set_out_colorspace(ColorSpace::Luma);

let mut d = JpegDecoder::new_with_options(options, buf);
let mut d = JpegDecoder::new_with_options(buf, options);

d.decode().unwrap()
}
Expand Down Expand Up @@ -253,7 +253,7 @@ fn decode_hv_samp_prog(c: &mut Criterion) {
}

fn decode_jpeg_opts(buf: &[u8], options: DecoderOptions) -> Vec<u8> {
let mut d = JpegDecoder::new_with_options(options, buf);
let mut d = JpegDecoder::new_with_options(buf, options);

d.decode().unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion zune-imageprocs/src/box_blur.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub(crate) fn box_blur_f32_inner(
{
let half_radius = (radius + 1) / 2;

let mut accumulator: f32 = stride_in[..half_radius].iter().map(|x| f32::from(*x)).sum();
let mut accumulator: f32 = stride_in[..half_radius].iter().copied().sum();

accumulator += (half_radius as f32) * stride_in[0];

Expand Down
2 changes: 1 addition & 1 deletion zune-imageprocs/src/premul_alpha/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ fn test_inverse_sse_scalar() {
assert!(a.is_finite());
assert!(b.is_finite());

assert!(diff < f32::EPSILON, "{} {}", a, b);
assert!(diff < f32::EPSILON, "{a} {b}");
}
}
2 changes: 1 addition & 1 deletion zune-imageprocs/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl NumOps<f32> for f32 {
}

fn to_f64(self) -> f64 {
self as _
f64::from(self)
}

fn zclamp(self, min: f32, max: f32) -> f32 {
Expand Down
4 changes: 2 additions & 2 deletions zune-inflate/src/encoder/hc_matchfinder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl HcMatchFinder {
// compute the next hash codes
let n_hash4 = v_hash(next_window, HASH_FOUR_LOG_SIZE, self.min_length);

self.next_hash[1] = n_hash4 as usize;
self.next_hash[1] = n_hash4;
let mut match_found = false;

if cur_offset != 0 {
Expand Down Expand Up @@ -271,7 +271,7 @@ impl HcMatchFinder {
depth -= 1;
}
}
return match_found;
match_found
}

#[inline(always)]
Expand Down
2 changes: 1 addition & 1 deletion zune-jpeg/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Debug for DecodeErrors {
Self::ExhaustedData => write!(f, "Exhausted data in the image"),
Self::LargeDimensions(ref dimensions) => write!(
f,
"Too large dimensions {dimensions},library supports up to {MAX_DIMENSIONS}"
"Too large dimensions {dimensions},library supports up to {}", crate::decoder::MAX_DIMENSIONS
),
Self::TooSmallOutput(expected, found) => write!(f, "Too small output, expected buffer with at least {expected} bytes but got one with {found} bytes")
}
Expand Down
2 changes: 1 addition & 1 deletion zune-png/src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl<'a> PngEncoder<'a> {
// divide each into 8192 bytes
let mut extra_bytes = (raw_len + 8191) / 8192;
// for each extra byte, add header, length and crc
extra_bytes = extra_bytes * (4 + 4 + 4);
extra_bytes *= 4 + 4 + 4;

out_dims += extra_bytes;
}
Expand Down

0 comments on commit 957e5fd

Please sign in to comment.