Skip to content

Commit f2cbaf1

Browse files
RUST-2158 update edition & rand crate (#516)
--------- Co-authored-by: Isabel Atkinson <[email protected]>
1 parent aff37cf commit f2cbaf1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description = "Encoding and decoding support for BSON in Rust"
1313
license = "MIT"
1414
readme = "README.md"
1515
repository = "https://github.com/mongodb/bson-rust"
16-
edition = "2018"
16+
edition = "2021"
1717
keywords = ["bson", "mongodb", "serde", "serialization", "deserialization"]
1818
categories = ["encoding"]
1919

@@ -58,7 +58,7 @@ name = "bson"
5858
[dependencies]
5959
ahash = "0.8.0"
6060
chrono = { version = "0.4.15", features = ["std"], default-features = false, optional = true }
61-
rand = "0.8"
61+
rand = "0.9"
6262
serde = { version = "1.0", features = ["derive"] }
6363
serde_json = { version = "1.0", features = ["preserve_order"] }
6464
indexmap = "2.1.0"

src/oid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::{convert::TryInto, time::SystemTime};
1414

1515
use hex::{self, FromHexError};
1616
use once_cell::sync::Lazy;
17-
use rand::{random, thread_rng, Rng};
17+
use rand::{random, rng, Rng};
1818

1919
const TIMESTAMP_SIZE: usize = 4;
2020
const PROCESS_ID_SIZE: usize = 5;
@@ -27,7 +27,7 @@ const COUNTER_OFFSET: usize = PROCESS_ID_OFFSET + PROCESS_ID_SIZE;
2727
const MAX_U24: usize = 0xFF_FFFF;
2828

2929
static OID_COUNTER: Lazy<AtomicUsize> =
30-
Lazy::new(|| AtomicUsize::new(thread_rng().gen_range(0..=MAX_U24)));
30+
Lazy::new(|| AtomicUsize::new(rng().random_range(0..=MAX_U24)));
3131

3232
/// Errors that can occur during [`ObjectId`] construction and generation.
3333
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)