Skip to content

Commit 26bc09b

Browse files
tclemCopilot
andcommitted
chore(deps): update cargo dependencies
Updated packages: 0.10 (major) 0.10 (major) Fixed breaking changes: - rand 0.10 moved random()/random_range() from Rng to RngExt trait Rng (in rand_core) - rand 0.10 removed RngCore re-export from rand crate rand::make_rng() Supersedes: #100, #101 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1c55dd8 commit 26bc09b

File tree

14 files changed

+24
-27
lines changed

14 files changed

+24
-27
lines changed

crates/bpe/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ aneubeck-daachorse = "1.1.1"
2121
base64 = { version = "0.22", optional = true }
2222
fnv = "1.0"
2323
itertools = "0.14"
24-
rand = { version = "0.9", optional = true }
24+
rand = { version = "0.10", optional = true }
2525
serde = { version = "1", features = ["derive"] }
2626

2727
[dev-dependencies]

crates/bpe/benchmarks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ test = true
2121
bpe = { path = "../../bpe", features = ["rand", "tiktoken"] }
2222
bpe-openai = { path = "../../bpe-openai" }
2323
criterion = "0.8"
24-
rand = "0.9"
24+
rand = "0.10"
2525
tiktoken-rs = "0.9"
2626
tokenizers = { version = "0.22", features = ["http"] }

crates/bpe/benchmarks/performance.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use bpe_benchmarks::*;
99
use criterion::{
1010
criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration,
1111
};
12-
use rand::rngs::StdRng;
13-
use rand::SeedableRng;
14-
use rand::{rng, Rng};
12+
use rand::{rng, RngExt};
1513

1614
fn counting_benchmark(c: &mut Criterion) {
1715
for (name, bpe, _, _) in TOKENIZERS.iter() {

crates/bpe/src/byte_pair_encoding.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub fn find_hash_factor_for_tiktoken(data: &str) -> Result<u64, base64::DecodeEr
168168
pub fn find_hash_factor_for_dictionary(tokens: impl IntoIterator<Item = Vec<u8>>) -> u64 {
169169
use std::collections::HashSet;
170170

171-
use rand::Rng;
171+
use rand::RngExt;
172172

173173
let all_tokens = tokens.into_iter().collect_vec();
174174
let mut rnd = rand::rng();
@@ -573,7 +573,7 @@ impl BytePairEncoding {
573573
// and hence may include previously discarded token later down the byte stream. At the sentence level though we don't expect it to make much difference.
574574
// Also, this implementation of BPE constructs merges on the fly from the set of tokens, hence might come up with a different set of merges with the same dictionary.
575575
#[cfg(feature = "rand")]
576-
pub fn encode_minimal_dropout<R: rand::Rng>(
576+
pub fn encode_minimal_dropout<R: rand::RngExt>(
577577
&self,
578578
text: &[u8],
579579
dropout: f32,
@@ -627,7 +627,7 @@ pub fn create_test_string_with_predicate(
627627
min_bytes: usize,
628628
predicate: impl Fn(&str) -> bool,
629629
) -> String {
630-
use rand::{rng, Rng};
630+
use rand::{rng, RngExt};
631631
// the string we accumulated thus far
632632
let mut result = String::new();
633633
// the tokens we added so we can backtrack
@@ -662,7 +662,7 @@ pub fn create_test_string_with_predicate(
662662

663663
#[cfg(feature = "rand")]
664664
pub fn select_test_string(text: &str, min_bytes: usize) -> &str {
665-
use rand::{rng, Rng};
665+
use rand::{rng, RngExt};
666666
let mut start = rng().random_range(0..text.len() - min_bytes);
667667
while !text.is_char_boundary(start) {
668668
start -= 1;
@@ -677,7 +677,7 @@ pub fn select_test_string(text: &str, min_bytes: usize) -> &str {
677677
/// Generate test bytes by concatenating random tokens.
678678
#[cfg(feature = "rand")]
679679
pub fn create_test_bytes(bpe: &BytePairEncoding, min_bytes: usize) -> Vec<u8> {
680-
use rand::{rng, Rng};
680+
use rand::{rng, RngExt};
681681
let mut result = Vec::new();
682682
while result.len() < min_bytes {
683683
let i = rng().random_range(0..bpe.num_tokens());

crates/bpe/tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ edition = "2021"
66
bpe = { path = "../../bpe", features = ["rand"] }
77
bpe-openai = { path = "../../bpe-openai" }
88
itertools = "0.14"
9-
rand = "0.9"
9+
rand = "0.10"
1010
tiktoken-rs = "0.9"

crates/bpe/tests/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(test)]
22
mod tests {
33
use itertools::Itertools;
4-
use rand::{rng, Rng};
4+
use rand::{rng, RngExt};
55
use tiktoken_rs::cl100k_base_singleton;
66

77
use bpe::appendable_encoder::AppendableEncoder;

crates/geo_filters/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ fnv = "1.0"
3030
hyperloglogplus = { version = "0.4", optional = true }
3131
itertools = "0.14"
3232
once_cell = "1.18"
33-
rand = { version = "0.9", optional = true }
33+
rand = { version = "0.10", optional = true }
3434
rayon = { version = "1.7", optional = true }
3535
regex = { version = "1", optional = true }
3636
serde = { version = "1.0", default-features = false, optional = true }
37-
rand_chacha = { version = "0.9", optional = true }
37+
rand_chacha = { version = "0.10", optional = true }
3838

3939
[dev-dependencies]
4040
criterion = "0.8"
4141
geo_filters = { path = ".", features = ["evaluation"] }
42-
rand = "0.9"
43-
rand_chacha = "0.9"
42+
rand = "0.10"
43+
rand_chacha = "0.10"
4444
rayon = "1.7"
4545

4646
[[bench]]

crates/geo_filters/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ pub(crate) fn take_ref<I: Iterator>(iter: &mut I, n: usize) -> impl Iterator<Ite
353353

354354
#[cfg(test)]
355355
pub(crate) mod tests {
356-
use rand::RngCore;
356+
use rand::Rng as RngCore;
357357
use rand_chacha::ChaCha12Rng;
358358

359359
use crate::{Count, Method};

crates/geo_filters/src/config/lookup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl HashToBucketLookup {
4545

4646
#[cfg(test)]
4747
mod tests {
48-
use rand::RngCore;
48+
use rand::Rng as RngCore;
4949
use rand_chacha::ChaCha12Rng;
5050

5151
use crate::{

crates/geo_filters/src/diff_count.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,7 @@ impl<'a, C: GeoConfig<Diff>> GeoDiffCount<'a, C> {
362362
/// the resulting geofilter should always be the same.
363363
#[cfg(any(test, feature = "test-support"))]
364364
pub fn pseudorandom_filter_with_config(config: C, items: usize) -> Self {
365-
use rand::RngCore;
366-
use rand_chacha::rand_core::SeedableRng;
365+
use rand_chacha::rand_core::{Rng, SeedableRng};
367366

368367
let mut rng = rand_chacha::ChaCha12Rng::seed_from_u64(items as u64);
369368
let mut filter = Self::new(config);
@@ -468,7 +467,7 @@ mod tests {
468467
use std::io::Write;
469468

470469
use itertools::Itertools;
471-
use rand::{seq::IteratorRandom, RngCore};
470+
use rand::{seq::IteratorRandom, Rng as RngCore};
472471
use rand_chacha::ChaCha12Rng;
473472

474473
use crate::{

0 commit comments

Comments
 (0)