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

Update dependencies and fix newer clippy warnings. #62

Merged
merged 1 commit into from
Dec 2, 2024
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
49 changes: 29 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions jxl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
thiserror = "1.0"
thiserror = "2.0"
byteorder = "1.4.3"
num-derive = "0.3"
num-derive = "0.4"
num-traits = "0.2.14"
array-init = "2.0.0"
half = "1.7.1"
half = "2.4.1"
tracing = { version = "0.1.40", optional = true }
jxl_macros = { path = "../jxl_macros" }

Expand Down
2 changes: 1 addition & 1 deletion jxl/src/container/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl std::fmt::Debug for ParseEvents<'_, '_> {
}
}

impl<'inner, 'buf> Iterator for ParseEvents<'inner, 'buf> {
impl<'buf> Iterator for ParseEvents<'_, 'buf> {
type Item = Result<ParseEvent<'buf>>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
4 changes: 2 additions & 2 deletions jxl/src/entropy_coding/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ enum ReaderLz77Config<'a> {
Enabled(Lz77ReaderInner<'a>),
}

impl<'a> Reader<'a> {
impl Reader<'_> {
pub fn read(&mut self, br: &mut BitReader, context: usize) -> Result<u32> {
let cluster = self.histograms.map_context_to_cluster(context);
match &mut self.lz77_config {
Expand Down Expand Up @@ -103,7 +103,7 @@ pub(super) struct ReaderInner<'a> {
ans_reader: AnsReader,
}

impl<'a> ReaderInner<'a> {
impl ReaderInner<'_> {
pub(super) fn read_token_clustered(
&mut self,
br: &mut BitReader,
Expand Down
2 changes: 1 addition & 1 deletion jxl/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub enum Error {
Lz77Disallowed,
#[error("LZ77 repeat symbol encountered without decoding any symbols")]
UnexpectedLz77Repeat,
#[error("Huffman alphabet too large: {0}, max is {}", 1 << HUFFMAN_MAX_BITS)]
#[error("Huffman alphabet too large: {0}, max is {max}", max = 1 << HUFFMAN_MAX_BITS)]
AlphabetTooLargeHuff(usize),
#[error("Invalid Huffman code")]
InvalidHuffman,
Expand Down
8 changes: 4 additions & 4 deletions jxl/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct ImageRectMut<'a, T: ImageDataType> {
image: &'a mut Image<T>,
}

impl<'a, T: ImageDataType> Debug for ImageRect<'a, T> {
impl<T: ImageDataType> Debug for ImageRect<'_, T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
Expand All @@ -139,7 +139,7 @@ impl<'a, T: ImageDataType> Debug for ImageRect<'a, T> {
}
}

impl<'a, T: ImageDataType> Debug for ImageRectMut<'a, T> {
impl<T: ImageDataType> Debug for ImageRectMut<'_, T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
Expand Down Expand Up @@ -344,7 +344,7 @@ impl<'a, T: ImageDataType> PartialEq<ImageRect<'a, T>> for ImageRect<'a, T> {
}
}

impl<'a, T: ImageDataType + Eq> Eq for ImageRect<'a, T> {}
impl<T: ImageDataType + Eq> Eq for ImageRect<'_, T> {}

impl<'a, T: ImageDataType> ImageRectMut<'a, T> {
pub fn rect(
Expand Down Expand Up @@ -473,7 +473,7 @@ pub mod debug_tools {
}
}

impl<'a, T: ImageDataType + ToU8ForWriting> ImageRect<'a, T> {
impl<T: ImageDataType + ToU8ForWriting> ImageRect<'_, T> {
pub fn to_pgm(&self) -> Vec<u8> {
use std::io::Write;
let mut ret = vec![];
Expand Down
2 changes: 1 addition & 1 deletion jxl_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ proc-macro = true
proc-macro2 = "1.0"
proc-macro-error = "1.0"
quote = "1.0"
syn = { version = "1.0.45", features = ["extra-traits", "full"] }
syn = { version = "2.0.90", features = ["extra-traits", "full"] }

[lints]
workspace = true
25 changes: 11 additions & 14 deletions jxl_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use proc_macro_error::{abort, proc_macro_error};
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
use syn::{parse_macro_input, DeriveInput, Meta};

fn get_bits(expr_call: &syn::ExprCall) -> syn::Expr {
if let syn::Expr::Path(ep) = &*expr_call.func {
Expand Down Expand Up @@ -277,7 +277,7 @@ impl Field {

// Parse attributes.
for a in &f.attrs {
match a.path.get_ident().map(syn::Ident::to_string).as_deref() {
match a.path().get_ident().map(syn::Ident::to_string).as_deref() {
Some("coder") => {
if coder.is_some() {
abort!(f, "Repeated coder");
Expand Down Expand Up @@ -363,14 +363,11 @@ impl Field {
});
}
Some("nonserialized") => {
for tok in a.tokens.clone() {
if let proc_macro2::TokenTree::Group(g) = tok {
let stream = g.stream();
nonserialized.push(quote! {#stream});
} else {
abort!(a, "Invalid attribute");
}
}
let Meta::List(ns) = &a.meta else {
abort!(a, "Invalid attribute");
};
let stream = &ns.tokens;
nonserialized.push(quote! {#stream});
}
_ => {}
}
Expand Down Expand Up @@ -517,13 +514,13 @@ impl Field {
fn derive_struct(input: DeriveInput) -> TokenStream2 {
let name = &input.ident;

let trace = input.attrs.iter().any(|a| a.path.is_ident("trace"));
let validate = input.attrs.iter().any(|a| a.path.is_ident("validate"));
let trace = input.attrs.iter().any(|a| a.path().is_ident("trace"));
let validate = input.attrs.iter().any(|a| a.path().is_ident("validate"));
let nonserialized: Vec<_> = input
.attrs
.iter()
.filter_map(|a| {
if a.path.is_ident("nonserialized") {
if a.path().is_ident("nonserialized") {
Some(a.parse_args::<syn::Expr>().unwrap())
} else {
None
Expand Down Expand Up @@ -592,7 +589,7 @@ fn derive_struct(input: DeriveInput) -> TokenStream2 {
quote! {}
};

let align = match input.attrs.iter().any(|a| a.path.is_ident("aligned")) {
let align = match input.attrs.iter().any(|a| a.path().is_ident("aligned")) {
true => quote! { br.jump_to_byte_boundary()?; },
false => quote! {},
};
Expand Down
Loading