Skip to content

RUST-2158 update edition & rand crate #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description = "Encoding and decoding support for BSON in Rust"
license = "MIT"
readme = "README.md"
repository = "https://github.com/mongodb/bson-rust"
edition = "2018"
edition = "2021"
keywords = ["bson", "mongodb", "serde", "serialization", "deserialization"]
categories = ["encoding"]

Expand Down Expand Up @@ -58,7 +58,7 @@ name = "bson"
[dependencies]
ahash = "0.8.0"
chrono = { version = "0.4.15", features = ["std"], default-features = false, optional = true }
rand = "0.8"
rand = "0.9"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "2.1.0"
Expand Down
4 changes: 2 additions & 2 deletions src/oid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{convert::TryInto, time::SystemTime};

use hex::{self, FromHexError};
use once_cell::sync::Lazy;
use rand::{random, thread_rng, Rng};
use rand::{random, rng, Rng};

const TIMESTAMP_SIZE: usize = 4;
const PROCESS_ID_SIZE: usize = 5;
Expand All @@ -27,7 +27,7 @@ const COUNTER_OFFSET: usize = PROCESS_ID_OFFSET + PROCESS_ID_SIZE;
const MAX_U24: usize = 0xFF_FFFF;

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

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