Skip to content

Commit

Permalink
clientinfo: replace lazy_static w/ once_cell
Browse files Browse the repository at this point in the history
Summary: I think once_cell is the recommended way these days.

Reviewed By: quark-zju

Differential Revision: D67045389

fbshipit-source-id: 0d080a0f542b4c796e3c3f0a7f6610c4b3d1acff
  • Loading branch information
muirdm authored and facebook-github-bot committed Dec 11, 2024
1 parent 70e961c commit 059c492
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion eden/scm/lib/clientinfo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ name = "clientinfo"
[dependencies]
anyhow = "1.0.86"
hostname = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
lazy_static = "1.4"
once_cell = "1.12"
rand = { version = "0.8", features = ["small_rng"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_json = { version = "1.0.132", features = ["float_roundtrip", "unbounded_depth"] }
Expand Down
6 changes: 2 additions & 4 deletions eden/scm/lib/clientinfo/src/request_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::fmt::Display;

use anyhow::anyhow;
use anyhow::Result;
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use rand::distributions::Alphanumeric;
use rand::thread_rng;
use rand::Rng;
Expand All @@ -27,9 +27,7 @@ const DEFAULT_CLIENT_ENTRY_POINT_SAPLING: ClientEntryPoint = ClientEntryPoint::S
const DEFAULT_CLIENT_ENTRY_POINT_EDENFS: ClientEntryPoint = ClientEntryPoint::EdenFs;

// The global static ClientRequestInfo
lazy_static! {
pub static ref CLIENT_REQUEST_INFO: ClientRequestInfo = new_client_request_info();
}
pub static CLIENT_REQUEST_INFO: Lazy<ClientRequestInfo> = Lazy::new(new_client_request_info);

/// Get a copy of the global static ClientRequestInfo
pub fn get_client_request_info() -> ClientRequestInfo {
Expand Down

0 comments on commit 059c492

Please sign in to comment.