Skip to content
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 by Bors] - Remove lazy_static in favor of once_cell #3466

Closed
Closed
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/fluvio-package-index/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-package-index"
version = "0.7.4"
version = "0.7.5"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Fluvio Package Index"
repository = "https://github.com/infinyon/fluvio"
Expand All @@ -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"] }
16 changes: 7 additions & 9 deletions crates/fluvio-package-index/src/package_id.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::fmt;
use once_cell::sync::Lazy;
use serde::{Serialize, Deserialize, Deserializer, Serializer};
use url::Url;
use crate::Error;
Expand All @@ -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<Registry> = Lazy::new(|| {
let url = url::Url::parse("https://packages.fluvio.io/v1/").unwrap();
Registry::from(url)
});

static DEFAULT_GROUP: Lazy<GroupName> = Lazy::new(|| GroupName("fluvio".to_owned()));

impl fmt::Display for Registry {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
Loading