From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox v2 11/12] schema: remove lazy_static dependency
Date: Wed, 14 Aug 2024 09:20:00 +0200 [thread overview]
Message-ID: <20240814072001.53422-11-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240814072001.53422-1-m.sandoval@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxmox-schema/Cargo.toml | 2 +-
proxmox-schema/src/const_regex.rs | 6 ++----
proxmox-schema/src/lib.rs | 8 --------
3 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/proxmox-schema/Cargo.toml b/proxmox-schema/Cargo.toml
index f3aea3e1..ac4839e9 100644
--- a/proxmox-schema/Cargo.toml
+++ b/proxmox-schema/Cargo.toml
@@ -6,13 +6,13 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
description = "proxmox api schema and validation"
+rust-version.workspace = true
exclude.workspace = true
[dependencies]
anyhow.workspace = true
const_format = { workspace = true, optional = true }
-lazy_static.workspace = true
regex.workspace = true
serde.workspace = true
serde_json.workspace = true
diff --git a/proxmox-schema/src/const_regex.rs b/proxmox-schema/src/const_regex.rs
index 3a5c2dab..8ddc41ab 100644
--- a/proxmox-schema/src/const_regex.rs
+++ b/proxmox-schema/src/const_regex.rs
@@ -5,7 +5,7 @@ use std::fmt;
/// The current Regex::new() function is not `const_fn`. Unless that
/// works, we use `ConstRegexPattern` to represent static regular
/// expressions. Please use the `const_regex` macro to generate
-/// instances of this type (uses lazy_static).
+/// instances of this type.
pub struct ConstRegexPattern {
/// This is only used for documentation and debugging
pub regex_string: &'static str,
@@ -47,9 +47,7 @@ macro_rules! const_regex {
$crate::ConstRegexPattern {
regex_string: $regex,
regex_obj: (|| -> &'static ::regex::Regex {
- $crate::semver_exempt::lazy_static! {
- static ref SCHEMA: ::regex::Regex = ::regex::Regex::new($regex).unwrap();
- }
+ static SCHEMA: std::sync::LazyLock<::regex::Regex> = std::sync::LazyLock::new(|| ::regex::Regex::new($regex).unwrap());
&SCHEMA
})
};
diff --git a/proxmox-schema/src/lib.rs b/proxmox-schema/src/lib.rs
index c91b5fd6..161f53ce 100644
--- a/proxmox-schema/src/lib.rs
+++ b/proxmox-schema/src/lib.rs
@@ -29,13 +29,5 @@ pub use schema::*;
pub mod upid;
-// const_regex uses lazy_static, but we otherwise don't need it, and don't want to force users to
-// have to write it out in their Cargo.toml as dependency, so we add a hidden re-export here which
-// is semver-exempt!
-#[doc(hidden)]
-pub mod semver_exempt {
- pub use lazy_static::lazy_static;
-}
-
#[cfg(feature = "api-types")]
pub mod api_types;
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-08-14 7:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 7:19 [pbs-devel] [PATCH proxmox v2 01/12] cargo: set msrv to 1.80 Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 02/12] dns-api: remove lazy-static dependency Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 03/12] async: remove lazy_static dependency Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 04/12] subscription: " Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 05/12] rest-server: " Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 06/12] time: " Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 07/12] sys: " Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 08/12] network-api: " Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 09/12] auth-api: " Maximiliano Sandoval
2024-08-14 7:19 ` [pbs-devel] [PATCH proxmox v2 10/12] acme-api: " Maximiliano Sandoval
2024-08-14 7:20 ` Maximiliano Sandoval [this message]
2024-08-14 7:20 ` [pbs-devel] [PATCH proxmox v2 12/12] cargo: remove lazy_static dependency on workspace Maximiliano Sandoval
2024-08-14 8:51 ` [pbs-devel] [PATCH proxmox v2 01/12] cargo: set msrv to 1.80 Wolfgang Bumiller
2024-08-14 10:04 ` [pbs-devel] applied-series: " Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240814072001.53422-11-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.