Skip to content

Commit

Permalink
upgrade rand to 0.9 (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
CrockAgile authored Jan 30, 2025
1 parent ce60ac2 commit 964f46a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo llvm-cov
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
run: cargo llvm-cov --all-features --lcov --output-path lcov.info --no-cfg-coverage --no-cfg-coverage-nightly
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tracing-flame = { version = "0.2.0", optional = true }
hashbrown = "0.15.0"

[dependencies.rand]
version = "0.8.0"
version = "0.9"

[dependencies.nom]
version = "^7.0.0"
Expand Down Expand Up @@ -90,4 +90,4 @@ name = "divan"
harness = false

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2.5", features = ["js"] } # needed for rand
getrandom = { version = "0.3.1", features = ["wasm_js"] } # needed for rand
2 changes: 1 addition & 1 deletion benches/criterion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod util;

use bnf::Grammar;
use criterion::{criterion_group, criterion_main, Criterion};
use rand::seq::SliceRandom;
use rand::seq::IndexedRandom;

fn examples(c: &mut Criterion) {
let _tracing = util::init_tracing();
Expand Down
2 changes: 1 addition & 1 deletion benches/divan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod examples {
let mut rng: rand::rngs::StdRng = rand::SeedableRng::seed_from_u64(0);

bencher
.with_inputs(|| rng.gen_range(1..100))
.with_inputs(|| rng.random_range(1..100))
.count_inputs_as::<divan::counter::ItemsCount>()
.bench_local_values(|parse_count| {
infinite_grammar
Expand Down
4 changes: 2 additions & 2 deletions src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::production::Production;
use crate::term::Term;
#[cfg(feature = "ABNF")]
use crate::ABNF;
use rand::{rngs::StdRng, seq::SliceRandom, thread_rng, Rng, SeedableRng};
use rand::{rng, rngs::StdRng, seq::IndexedRandom, Rng, SeedableRng};

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -428,7 +428,7 @@ impl Grammar {
pub fn generate_callback(&self, f: impl Fn(&str, &str) -> bool) -> Result<String, Error> {
// let seed: &[_] = &[1, 2, 3, 4];
let mut seed: [u8; 32] = [0; 32];
thread_rng().fill(&mut seed);
rng().fill(&mut seed);
let mut rng: StdRng = SeedableRng::from_seed(seed);
self.generate_seeded_callback(&mut rng, f)
}
Expand Down

0 comments on commit 964f46a

Please sign in to comment.