From 857bb359ef235e38cc15cd56b6a8e59c7d88dcd1 Mon Sep 17 00:00:00 2001 From: Prashant Deva Date: Thu, 2 Nov 2023 23:54:51 -0700 Subject: [PATCH 1/2] use random() directly simply code --- src/oid.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/oid.rs b/src/oid.rs index 1e5f7ad5..89f1e369 100644 --- a/src/oid.rs +++ b/src/oid.rs @@ -14,7 +14,7 @@ use std::{convert::TryInto, time::SystemTime}; use hex::{self, FromHexError}; use once_cell::sync::Lazy; -use rand::{thread_rng, Rng}; +use rand::{thread_rng, Rng, random}; const TIMESTAMP_SIZE: usize = 4; const PROCESS_ID_SIZE: usize = 5; @@ -253,7 +253,7 @@ impl ObjectId { /// Generate a random 5-byte array. fn gen_process_id() -> [u8; 5] { - static BUF: Lazy<[u8; 5]> = Lazy::new(|| thread_rng().gen()); + static BUF: Lazy<[u8; 5]> = Lazy::new(random); *BUF } From 187715f098c152f1c0f653785746f701c5d0ad11 Mon Sep 17 00:00:00 2001 From: Isabel Atkinson Date: Tue, 7 Nov 2023 10:18:22 -0700 Subject: [PATCH 2/2] format --- src/oid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oid.rs b/src/oid.rs index 89f1e369..47dc3907 100644 --- a/src/oid.rs +++ b/src/oid.rs @@ -14,7 +14,7 @@ use std::{convert::TryInto, time::SystemTime}; use hex::{self, FromHexError}; use once_cell::sync::Lazy; -use rand::{thread_rng, Rng, random}; +use rand::{random, thread_rng, Rng}; const TIMESTAMP_SIZE: usize = 4; const PROCESS_ID_SIZE: usize = 5;