From 865409a812d05dcd4922e04866e158c4f61b55ef Mon Sep 17 00:00:00 2001 From: Matheus Consoli Date: Fri, 11 Aug 2023 02:24:48 -0300 Subject: [PATCH 1/2] Remove lazy_static in favor of once_cell --- Cargo.lock | 2 +- crates/fluvio-package-index/Cargo.toml | 4 ++-- crates/fluvio-package-index/src/package_id.rs | 16 +++++++--------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cde7e045ed..5d76c549c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2791,7 +2791,7 @@ name = "fluvio-package-index" version = "0.7.4" dependencies = [ "http", - "lazy_static", + "once_cell", "semver 1.0.18", "serde", "serde_json", diff --git a/crates/fluvio-package-index/Cargo.toml b/crates/fluvio-package-index/Cargo.toml index 3c136016d2..602d7b8486 100644 --- a/crates/fluvio-package-index/Cargo.toml +++ b/crates/fluvio-package-index/Cargo.toml @@ -16,11 +16,11 @@ path = "src/lib.rs" http_agent = ["http"] [dependencies] -lazy_static = "1.4.0" http = { version = "0.2", default-features = false, optional = true} +once_cell = { workspace = true } +semver = { workspace = true, features = ["serde"] } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } -semver = { workspace = true, features = ["serde"] } thiserror = { workspace = true } tracing = { workspace = true } url = { workspace = true, features = ["serde"] } \ No newline at end of file diff --git a/crates/fluvio-package-index/src/package_id.rs b/crates/fluvio-package-index/src/package_id.rs index 9b1c4b69fc..b3faf3714a 100644 --- a/crates/fluvio-package-index/src/package_id.rs +++ b/crates/fluvio-package-index/src/package_id.rs @@ -1,4 +1,5 @@ use std::fmt; +use once_cell::sync::Lazy; use serde::{Serialize, Deserialize, Deserializer, Serializer}; use url::Url; use crate::Error; @@ -24,15 +25,12 @@ impl Registry { } } -lazy_static::lazy_static! { - static ref DEFAULT_REGISTRY: Registry = { - let url = url::Url::parse("https://packages.fluvio.io/v1/").unwrap(); - Registry::from(url) - }; - static ref DEFAULT_GROUP: GroupName = { - "fluvio".parse().unwrap() - }; -} +static DEFAULT_REGISTRY: Lazy = Lazy::new(|| { + let url = url::Url::parse("https://packages.fluvio.io/v1/").unwrap(); + Registry::from(url) +}); + +static DEFAULT_GROUP: Lazy = Lazy::new(|| GroupName("fluvio".to_owned())); impl fmt::Display for Registry { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { From 194a06ae8f28de8664ca4cdd60a98563fba0bf23 Mon Sep 17 00:00:00 2001 From: Matheus Consoli Date: Mon, 14 Aug 2023 16:27:03 -0300 Subject: [PATCH 2/2] Bump up `fluvio-package-index` minor version --- crates/fluvio-package-index/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fluvio-package-index/Cargo.toml b/crates/fluvio-package-index/Cargo.toml index 602d7b8486..9bdd6c5435 100644 --- a/crates/fluvio-package-index/Cargo.toml +++ b/crates/fluvio-package-index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fluvio-package-index" -version = "0.7.4" +version = "0.7.5" authors = ["Fluvio Contributors "] description = "Fluvio Package Index" repository = "https://github.com/infinyon/fluvio"