Skip to content

Commit 6845dba

Browse files
Upgrade rand crate from 0.8 to 0.9 version (#1309)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kai Ren <[email protected]>
1 parent f049481 commit 6845dba

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

juniper_actix/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bytes = "1.0"
4545
env_logger = "0.11"
4646
juniper = { version = "0.16", path = "../juniper", features = ["expose-test-schema"] }
4747
log = "0.4"
48-
rand = "0.8"
48+
rand = "0.9"
4949
tokio = "1.0"
5050

5151
[[example]]

juniper_actix/examples/subscription.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ impl Subscription {
8585
Second result will be an error."
8686
)]
8787
async fn random_human(context: &Database) -> RandomHumanStream {
88+
use rand::{rngs::StdRng, Rng as _, SeedableRng as _};
89+
8890
let mut counter = 0;
8991

9092
let context = (*context).clone();
9193

92-
use rand::{rngs::StdRng, Rng, SeedableRng};
93-
let mut rng = StdRng::from_entropy();
94+
let mut rng = StdRng::from_os_rng();
9495
let mut interval = tokio::time::interval(Duration::from_secs(5));
9596
let stream = async_stream::stream! {
9697
counter += 1;
@@ -102,7 +103,7 @@ impl Subscription {
102103
graphql_value!("some additional string"),
103104
))
104105
} else {
105-
let random_id = rng.gen_range(1000..1005).to_string();
106+
let random_id = rng.random_range(1000..1005).to_string();
106107
let human = context.get_human(&random_id).unwrap().clone();
107108

108109
yield Ok(RandomHuman {

0 commit comments

Comments
 (0)