From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 09/12] auth-api: remove lazy_static dependency
Date: Tue, 13 Aug 2024 12:57:06 +0200 [thread overview]
Message-ID: <20240813105709.320119-9-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240813105709.320119-1-m.sandoval@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxmox-auth-api/Cargo.toml | 4 ++--
proxmox-auth-api/debian/control | 1 -
proxmox-auth-api/src/types.rs | 11 ++++-------
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/proxmox-auth-api/Cargo.toml b/proxmox-auth-api/Cargo.toml
index 44db2bf8..62c173ad 100644
--- a/proxmox-auth-api/Cargo.toml
+++ b/proxmox-auth-api/Cargo.toml
@@ -7,6 +7,7 @@ license.workspace = true
repository.workspace = true
exclude.workspace = true
description = "Tickets, API and Realm handling"
+rust-version.workspace = true
[[example]]
name = "passwd"
@@ -16,7 +17,6 @@ required-features = [ "pam-authenticator" ]
anyhow.workspace = true
const_format = { workspace = true, optional = true }
base64 = { workspace = true, optional = true }
-lazy_static = { workspace = true, optional = true }
libc = { workspace = true, optional = true }
log = { workspace = true, optional = true }
http = { workspace = true, optional = true }
@@ -40,7 +40,7 @@ proxmox-tfa = { workspace = true, optional = true, features = [ "api" ] }
default = []
ticket = [ "dep:base64", "dep:percent-encoding", "dep:openssl" ]
-api-types = [ "dep:const_format", "dep:lazy_static", "dep:regex", "dep:serde", "dep:serde_plain", "dep:proxmox-schema" ]
+api-types = [ "dep:const_format", "dep:regex", "dep:serde", "dep:serde_plain", "dep:proxmox-schema" ]
api = [
"api-types",
"ticket",
diff --git a/proxmox-auth-api/debian/control b/proxmox-auth-api/debian/control
index adb94632..7198d318 100644
--- a/proxmox-auth-api/debian/control
+++ b/proxmox-auth-api/debian/control
@@ -66,7 +66,6 @@ Depends:
${misc:Depends},
librust-proxmox-auth-api-dev (= ${binary:Version}),
librust-const-format-0.2+default-dev,
- librust-lazy-static-1+default-dev (>= 1.4-~~),
librust-proxmox-schema-3+api-macro-dev (>= 3.1.2-~~),
librust-proxmox-schema-3+api-types-dev (>= 3.1.2-~~),
librust-proxmox-schema-3+default-dev (>= 3.1.2-~~),
diff --git a/proxmox-auth-api/src/types.rs b/proxmox-auth-api/src/types.rs
index 25e5feff..64c580a5 100644
--- a/proxmox-auth-api/src/types.rs
+++ b/proxmox-auth-api/src/types.rs
@@ -23,10 +23,10 @@
use std::borrow::Borrow;
use std::fmt;
+use std::sync::LazyLock;
use anyhow::{bail, format_err, Error};
use const_format::concatcp;
-use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use proxmox_schema::{
@@ -454,9 +454,7 @@ impl Userid {
}
}
-lazy_static! {
- pub static ref ROOT_USERID: Userid = Userid::new("root@pam".to_string(), 4);
-}
+pub static ROOT_USERID: LazyLock<Userid> = LazyLock::new(|| Userid::new("root@pam".to_string(), 4));
impl From<Authid> for Userid {
fn from(authid: Authid) -> Self {
@@ -587,9 +585,8 @@ impl Authid {
}
}
-lazy_static! {
- pub static ref ROOT_AUTHID: Authid = Authid::from(Userid::new("root@pam".to_string(), 4));
-}
+pub static ROOT_AUTHID: LazyLock<Authid> =
+ LazyLock::new(|| Authid::from(Userid::new("root@pam".to_string(), 4)));
impl From<Userid> for Authid {
fn from(parts: Userid) -> Self {
--
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-13 10:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 10:56 [pbs-devel] [PATCH proxmox 01/12] cargo: set msrv to 1.80 Maximiliano Sandoval
2024-08-13 10:56 ` [pbs-devel] [PATCH proxmox 02/12] dns-api: remove lazy-static dependency Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 03/12] async: remove lazy_static dependency Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 04/12] subscription: " Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 05/12] rest-server: " Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 06/12] time: " Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 07/12] sys: " Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 08/12] network-api: " Maximiliano Sandoval
2024-08-13 10:57 ` Maximiliano Sandoval [this message]
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 10/12] acme-api: " Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 11/12] schema: " Maximiliano Sandoval
2024-08-13 10:57 ` [pbs-devel] [PATCH proxmox 12/12] cargo: remove lazy_static dependency on workspace Maximiliano Sandoval
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=20240813105709.320119-9-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox