Skip to content

chore: update to 2024 edition #72

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
96 changes: 48 additions & 48 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
members = [".", "arithmetic-coding-core", "fenwick-model"]

[workspace.package]
rust-version = "1.83.0"
edition = "2021"
rust-version = "1.85.0"
edition = "2024"
license = "MIT"
keywords = ["compression", "encoding", "arithmetic-coding", "lossless"]
categories = ["compression", "encoding", "parsing"]
Expand Down
2 changes: 1 addition & 1 deletion arithmetic-coding-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ mod bitstore;
pub use bitstore::BitStore;

mod model;
pub use model::{fixed_length, max_length, one_shot, Model};
pub use model::{Model, fixed_length, max_length, one_shot};
2 changes: 1 addition & 1 deletion arithmetic-coding-core/src/model/one_shot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::ops::Range;

pub use crate::fixed_length::Wrapper;
use crate::{fixed_length, BitStore};
use crate::{BitStore, fixed_length};

/// A [`Model`] is used to calculate the probability of a given symbol occurring
/// in a sequence.
Expand Down
4 changes: 2 additions & 2 deletions benches/sherlock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fs::File, io::Read, ops::Range};

use arithmetic_coding::Model;
use fenwick_model::{simple::FenwickModel, ValueError};
use fenwick_model::{ValueError, simple::FenwickModel};

mod common;

Expand Down Expand Up @@ -58,7 +58,7 @@
common::round_trip(model, input);
}

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{Criterion, black_box, criterion_group, criterion_main};

Check warning on line 61 in benches/sherlock.rs

View workflow job for this annotation

GitHub Actions / lint

use of deprecated function `criterion::black_box`: use `std::hint::black_box()` instead

warning: use of deprecated function `criterion::black_box`: use `std::hint::black_box()` instead --> benches/sherlock.rs:61:28 | 61 | use criterion::{Criterion, black_box, criterion_group, criterion_main}; | ^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default

#[allow(clippy::missing_panics_doc)]
pub fn criterion_benchmark(c: &mut Criterion) {
Expand All @@ -71,7 +71,7 @@
let truncated: String = input_string.chars().take(3428).collect();
let input = truncated.as_bytes();

c.bench_function("round trip", |b| b.iter(|| round_trip(black_box(input))));

Check warning on line 74 in benches/sherlock.rs

View workflow job for this annotation

GitHub Actions / lint

use of deprecated function `criterion::black_box`: use `std::hint::black_box()` instead

warning: use of deprecated function `criterion::black_box`: use `std::hint::black_box()` instead --> benches/sherlock.rs:74:61 | 74 | c.bench_function("round trip", |b| b.iter(|| round_trip(black_box(input)))); | ^^^^^^^^^
}

criterion_group!(benches, criterion_benchmark);
Expand Down
2 changes: 1 addition & 1 deletion examples/fenwick_adaptive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use arithmetic_coding::Model;

mod common;

use fenwick_model::{simple::FenwickModel, ValueError};
use fenwick_model::{ValueError, simple::FenwickModel};

const ALPHABET: &str =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,\n-':()[]#*;\"!?*&é/àâè%@$";
Expand Down
2 changes: 1 addition & 1 deletion examples/fenwick_context_switching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use arithmetic_coding::Model;

mod common;

use fenwick_model::{context_switching::FenwickModel, ValueError};
use fenwick_model::{ValueError, context_switching::FenwickModel};

const ALPHABET: &str =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,\n-':()[]#*;\"!?*&é/àâè%@$";
Expand Down
2 changes: 1 addition & 1 deletion src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use bitstream_io::BitRead;

use crate::{
common::{self, assert_precision_sufficient},
BitStore, Model,
common::{self, assert_precision_sufficient},
};

// this algorithm is derived from this article - https://marknelson.us/posts/2014/10/19/data-compression-with-arithmetic-coding.html
Expand Down Expand Up @@ -100,7 +100,7 @@
/// Return an iterator over the decoded symbols.
///
/// The iterator will continue returning symbols until EOF is reached
pub const fn decode_all(&mut self) -> DecodeIter<M, R> {

Check warning on line 103 in src/decoder.rs

View workflow job for this annotation

GitHub Actions / lint

hiding a lifetime that's elided elsewhere is confusing

warning: hiding a lifetime that's elided elsewhere is confusing --> src/decoder.rs:103:29 | 103 | pub const fn decode_all(&mut self) -> DecodeIter<M, R> { | ^^^^^^^^^ ---------------- the same lifetime is hidden here | | | the lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default help: use `'_` for type paths | 103 | pub const fn decode_all(&mut self) -> DecodeIter<'_, M, R> { | +++
DecodeIter { decoder: self }
}

Expand Down
2 changes: 1 addition & 1 deletion src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::{io, ops::Range};
use bitstream_io::BitWrite;

use crate::{
common::{self, assert_precision_sufficient},
BitStore, Error, Model,
common::{self, assert_precision_sufficient},
};

// this algorithm is derived from this article - https://marknelson.us/posts/2014/10/19/data-compression-with-arithmetic-coding.html
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
missing_copy_implementations
)]

pub use arithmetic_coding_core::{fixed_length, max_length, one_shot, BitStore, Model};
pub use arithmetic_coding_core::{BitStore, Model, fixed_length, max_length, one_shot};

mod common;
pub mod decoder;
Expand Down
2 changes: 1 addition & 1 deletion tests/precision_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use std::{convert::Infallible, io::Cursor, ops::Range};

use arithmetic_coding::{decoder, encoder, Decoder, Encoder};
use arithmetic_coding::{Decoder, Encoder, decoder, encoder};
use arithmetic_coding_core::one_shot;
use bitstream_io::{BigEndian, BitReader, BitWriter};

Expand Down
Loading