From 4979d460516212901fd6933e0340b847cd700217 Mon Sep 17 00:00:00 2001 From: Peter Willemsen Date: Tue, 3 Sep 2024 22:37:15 +0200 Subject: [PATCH] Upgraded dependencies, fixed breaking changes --- Cargo.toml | 18 +++++++++--------- src/core.rs | 6 +++++- src/galois_16.rs | 4 ++-- src/tests/mod.rs | 4 ++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b3fd4a8..606f8f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,23 +37,23 @@ coveralls = { repository = "darrenldl/reed-solomon-erasure" } [dependencies] libc = { version = "0.2", optional = true } # `log2()` impl for `no_std` -libm = "0.2.1" -lru = "0.7.8" +libm = "0.2.8" +lru = "0.12.4" # Efficient `Mutex` implementation for `std` environment -parking_lot = { version = "0.11.2", optional = true } -smallvec = "1.2" +parking_lot = { version = "0.12.3", optional = true } +smallvec = "1.13" # `Mutex` implementation for `no_std` environment with the same high-level API as `parking_lot` -spin = { version = "0.9.2", default-features = false, features = ["spin_mutex"] } +spin = { version = "0.9.8", default-features = false, features = ["spin_mutex"] } [dev-dependencies] -rand = { version = "0.7.2", features = ["small_rng"] } -quickcheck = "0.9" +rand = { version = "0.8.5", features = ["small_rng"] } +quickcheck = "1.0" # Scientific benchmarking -criterion = { version = "0.4.0", features = ["html_reports"] } +criterion = { version = "0.5.1", features = ["html_reports"] } [build-dependencies] -cc = { version = "1.0", optional = true } +cc = { version = "1.1", optional = true } [[bench]] name = "bandwidth" diff --git a/src/core.rs b/src/core.rs index cde224f..20bf6e8 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,5 +1,7 @@ extern crate alloc; +use core::num::NonZeroUsize; + use alloc::sync::Arc; use alloc::vec; use alloc::vec::Vec; @@ -462,7 +464,9 @@ impl ReedSolomon { parity_shard_count: parity_shards, total_shard_count: total_shards, matrix, - data_decode_matrix_cache: Mutex::new(LruCache::new(DATA_DECODE_MATRIX_CACHE_CAPACITY)), + data_decode_matrix_cache: Mutex::new(LruCache::new( + NonZeroUsize::new(DATA_DECODE_MATRIX_CACHE_CAPACITY).unwrap(), + )), }) } diff --git a/src/galois_16.rs b/src/galois_16.rs index 500ac8d..7e6db5a 100644 --- a/src/galois_16.rs +++ b/src/galois_16.rs @@ -318,10 +318,10 @@ impl Element { #[cfg(test)] mod tests { use super::*; - use quickcheck::Arbitrary; + use quickcheck::{Arbitrary, Gen}; impl Arbitrary for Element { - fn arbitrary(gen: &mut G) -> Self { + fn arbitrary(gen: &mut Gen) -> Self { let a = u8::arbitrary(gen); let b = u8::arbitrary(gen); diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 488443b..accc5c0 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -119,8 +119,8 @@ fn test_too_many_shards() { fn test_shard_count() { let mut rng = thread_rng(); for _ in 0..10 { - let data_shard_count = rng.gen_range(1, 128); - let parity_shard_count = rng.gen_range(1, 128); + let data_shard_count = rng.gen_range(1..128); + let parity_shard_count = rng.gen_range(1..128); let total_shard_count = data_shard_count + parity_shard_count;