[pve-devel] [PATCH proxmox 1/2] notify: fix build warnings if not all features are enabled

Lukas Wagner l.wagner at proxmox.com
Mon Jul 24 14:31:24 CEST 2023


Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 proxmox-notify/src/api/mod.rs | 3 ++-
 proxmox-notify/src/config.rs  | 1 +
 proxmox-notify/src/context.rs | 1 +
 proxmox-notify/src/lib.rs     | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/proxmox-notify/src/api/mod.rs b/proxmox-notify/src/api/mod.rs
index 9a59719b..a4e0e40f 100644
--- a/proxmox-notify/src/api/mod.rs
+++ b/proxmox-notify/src/api/mod.rs
@@ -87,7 +87,8 @@ fn verify_digest(config: &Config, digest: Option<&[u8]>) -> Result<(), ApiError>
     Ok(())
 }
 
-fn ensure_endpoint_exists(config: &Config, name: &str) -> Result<(), ApiError> {
+fn ensure_endpoint_exists(#[allow(unused)] config: &Config, name: &str) -> Result<(), ApiError> {
+    #[allow(unused_mut)]
     let mut exists = false;
 
     #[cfg(feature = "sendmail")]
diff --git a/proxmox-notify/src/config.rs b/proxmox-notify/src/config.rs
index 645b7bf6..a5964007 100644
--- a/proxmox-notify/src/config.rs
+++ b/proxmox-notify/src/config.rs
@@ -57,6 +57,7 @@ fn config_init() -> SectionConfig {
 }
 
 fn private_config_init() -> SectionConfig {
+    #[allow(unused_mut)]
     let mut config = SectionConfig::new(&BACKEND_NAME_SCHEMA);
 
     #[cfg(feature = "gotify")]
diff --git a/proxmox-notify/src/context.rs b/proxmox-notify/src/context.rs
index 72e07d5b..b7b6a580 100644
--- a/proxmox-notify/src/context.rs
+++ b/proxmox-notify/src/context.rs
@@ -14,6 +14,7 @@ pub fn set_context(context: &'static dyn Context) {
     CONTEXT.set(context).expect("context has already been set");
 }
 
+#[allow(unused)] // context is not used if all endpoint features are disabled
 pub(crate) fn context() -> &'static dyn Context {
     *CONTEXT.get().expect("context has not been yet")
 }
diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs
index 6a52db06..e8cd6b08 100644
--- a/proxmox-notify/src/lib.rs
+++ b/proxmox-notify/src/lib.rs
@@ -226,6 +226,7 @@ macro_rules! parse_endpoints_without_private_config {
 impl Bus {
     /// Instantiate notification bus from a given configuration.
     pub fn from_config(config: &Config) -> Result<Self, Error> {
+        #[allow(unused_mut)]
         let mut endpoints = HashMap::new();
 
         // Instantiate endpoints
-- 
2.39.2






More information about the pve-devel mailing list