From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox] subscription: Use const rather than static
Date: Wed, 28 Feb 2024 10:54:56 +0100 [thread overview]
Message-ID: <20240228095456.159111-1-m.sandoval@proxmox.com> (raw)
A static is like a const that can mutate, we don't need that.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxmox-rest-server/src/formatter.rs | 2 +-
proxmox-subscription/src/subscription_info.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxmox-rest-server/src/formatter.rs b/proxmox-rest-server/src/formatter.rs
index d19d6805..b9ed3bce 100644
--- a/proxmox-rest-server/src/formatter.rs
+++ b/proxmox-rest-server/src/formatter.rs
@@ -41,7 +41,7 @@ pub trait OutputFormatter: Send + Sync {
}
}
-static JSON_CONTENT_TYPE: &str = "application/json;charset=UTF-8";
+const JSON_CONTENT_TYPE: &str = "application/json;charset=UTF-8";
fn json_data_response(data: Value) -> Response<Body> {
let json_str = data.to_string();
diff --git a/proxmox-subscription/src/subscription_info.rs b/proxmox-subscription/src/subscription_info.rs
index ae40dbff..c2e3e7ea 100644
--- a/proxmox-subscription/src/subscription_info.rs
+++ b/proxmox-subscription/src/subscription_info.rs
@@ -302,7 +302,7 @@ pub(crate) fn md5sum(data: &[u8]) -> Result<DigestBytes, Error> {
/// Generate the current system's "server ID".
pub fn get_hardware_address() -> Result<String, Error> {
- static FILENAME: &str = "/etc/ssh/ssh_host_rsa_key.pub";
+ const FILENAME: &str = "/etc/ssh/ssh_host_rsa_key.pub";
let contents = proxmox_sys::fs::file_get_contents(FILENAME)
.map_err(|e| format_err!("Error getting host key - {}", e))?;
--
2.39.2
next reply other threads:[~2024-02-28 9:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 9:54 Maximiliano Sandoval [this message]
2024-02-28 10:54 ` Max Carrara
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=20240228095456.159111-1-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