Skip to content

Commit

Permalink
Merge pull request #275 from linkmauve/edition-2021
Browse files Browse the repository at this point in the history
Bump to edition 2021
  • Loading branch information
fintelia authored Oct 15, 2023
2 parents c17977d + c523d94 commit bb26dc7
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "jpeg-decoder"
version = "0.3.0"
edition = "2018"
resolver = "2"
edition = "2021"

rust-version = "1.61.0"

Expand Down
2 changes: 1 addition & 1 deletion fuzz-afl/src/reproduce_decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fn main() {
let data = utils::read_file_from_args();
match decode(&data) {
Ok(bytes) => println!("Decoded {} bytes", bytes.len()),
Err(e) => println!("Decoder returned an error: {:?}\nNote: Not a panic, this is fine.", e),
Err(e) => println!("Decoder returned an error: {e:?}\nNote: Not a panic, this is fine."),
};
}
1 change: 0 additions & 1 deletion src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use alloc::{format, vec};
use core::cmp;
use core::mem;
use core::ops::Range;
use std::convert::TryInto;
use std::io::Read;

pub const MAX_COMPONENTS: usize = 4;
Expand Down
4 changes: 2 additions & 2 deletions src/idct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#![allow(clippy::erasing_op)]
#![allow(clippy::identity_op)]
use crate::parser::Dimensions;
use core::{convert::TryFrom, num::Wrapping};
use core::num::Wrapping;

pub(crate) fn choose_idct_size(full_size: Dimensions, requested_size: Dimensions) -> usize {
fn scaled(len: u16, scale: usize) -> u16 {
Expand Down Expand Up @@ -234,7 +234,7 @@ pub(crate) fn dequantize_and_idct_block(
output_linestride,
output,
),
_ => panic!("Unsupported IDCT scale {}/8", scale),
_ => panic!("Unsupported IDCT scale {scale}/8"),
}
}

Expand Down
1 change: 0 additions & 1 deletion src/worker/immediate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use alloc::vec;
use alloc::vec::Vec;
use core::mem;
use core::convert::TryInto;
use crate::decoder::MAX_COMPONENTS;
use crate::error::Result;
use crate::idct::dequantize_and_idct_block;
Expand Down
2 changes: 0 additions & 2 deletions src/worker/rayon.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::convert::TryInto;

use rayon::iter::{IndexedParallelIterator, ParallelIterator};
use rayon::slice::ParallelSliceMut;

Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn test_files(test_dir: &Path) -> Vec<PathBuf> {
let path = test_dir.join(Path::new(&line));

if !test_files.contains(&path) {
panic!("The file {:?} specified in {:?} could not be found among the files being tested", line, test_dir.join("disabled.txt"));
panic!("The file {line:?} specified in {:?} could not be found among the files being tested", test_dir.join("disabled.txt"));
}

let position = test_files.iter().position(|p| p == &path).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/reftest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn reftest_decoder<T: std::io::Read>(mut decoder: jpeg::Decoder<T>, path: &Path,
encoder.set_color(ref_pixel_format);
encoder.write_header().expect("png failed to write header").write_image_data(&pixels).expect("png failed to write data");

panic!("decoding difference: {:?}, maximum difference was {}", output_path, max_diff);
panic!("decoding difference: {output_path:?}, maximum difference was {max_diff}");
}
}

Expand Down

0 comments on commit bb26dc7

Please sign in to comment.