From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 787601FF167 for ; Wed, 14 Aug 2024 09:19:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5AF9AFC4D; Wed, 14 Aug 2024 09:20:09 +0200 (CEST) From: Maximiliano Sandoval To: pbs-devel@lists.proxmox.com Date: Wed, 14 Aug 2024 09:20:00 +0200 Message-Id: <20240814072001.53422-11-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240814072001.53422-1-m.sandoval@proxmox.com> References: <20240814072001.53422-1-m.sandoval@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.112 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH proxmox v2 11/12] schema: remove lazy_static dependency X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Maximiliano Sandoval --- 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