Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to edition 2021 #275

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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