From 462d31233faac930fda363acae0d3f2fbacc4e51 Mon Sep 17 00:00:00 2001 From: Lukas Piatkowski Date: Wed, 20 Jun 2018 18:20:42 -0700 Subject: [PATCH] fbwhoami: return a singleton for FbWhoAmI and DynoWhatAmI Summary: If someone realy doesn't want a singleton then one would need to use FbWhoAmI::parse_from directly, which is fine. Reviewed By: farnz Differential Revision: D8556535 fbshipit-source-id: 3f49970b7b9692277932407ca1ec888a0d9458c0 --- server/src/main.rs | 2 -- server/src/repo.rs | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 43b6525dd4..e110b58999 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -20,8 +20,6 @@ extern crate futures_stats; #[macro_use] extern crate futures_trace; extern crate itertools; -#[macro_use] -extern crate lazy_static; extern crate tokio; extern crate tokio_core; extern crate tokio_io; diff --git a/server/src/repo.rs b/server/src/repo.rs index 955d5b3274..c960f066de 100644 --- a/server/src/repo.rs +++ b/server/src/repo.rs @@ -59,10 +59,6 @@ const METAKEYFLAG: &str = "f"; const METAKEYSIZE: &str = "s"; const MAX_NODES_TO_LOG: usize = 5; -lazy_static! { - static ref WHOAMI: Option = FbWhoAmI::new().ok(); -} - mod ops { pub const HELLO: &str = "hello"; pub const UNBUNDLE: &str = "unbundle"; @@ -235,7 +231,7 @@ fn add_common_stats_and_send_to_scuba( sample.add("args", args); } - if let &Some(ref whoami) = &*WHOAMI { + if let Ok(whoami) = FbWhoAmI::new() { if let Some(hostname) = whoami.get_name() { sample.add("server_hostname", hostname); }