public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox 1/2] notify: fix build warnings if not all features are enabled
@ 2023-07-24 12:31 Lukas Wagner
  2023-07-24 12:31 ` [pve-devel] [PATCH proxmox 2/2] notify: fix tests " Lukas Wagner
  2023-07-28  8:45 ` [pve-devel] applied-series: [PATCH proxmox 1/2] notify: fix build warnings " Wolfgang Bumiller
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Wagner @ 2023-07-24 12:31 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Lukas Wagner <l.wagner@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH proxmox 2/2] notify: fix tests if not all features are enabled
  2023-07-24 12:31 [pve-devel] [PATCH proxmox 1/2] notify: fix build warnings if not all features are enabled Lukas Wagner
@ 2023-07-24 12:31 ` Lukas Wagner
  2023-07-28  8:45 ` [pve-devel] applied-series: [PATCH proxmox 1/2] notify: fix build warnings " Wolfgang Bumiller
  1 sibling, 0 replies; 3+ messages in thread
From: Lukas Wagner @ 2023-07-24 12:31 UTC (permalink / raw)
  To: pve-devel

Some tests are now disabled if not all required features are enabled.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 proxmox-notify/src/api/mod.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/proxmox-notify/src/api/mod.rs b/proxmox-notify/src/api/mod.rs
index a4e0e40f..9372443a 100644
--- a/proxmox-notify/src/api/mod.rs
+++ b/proxmox-notify/src/api/mod.rs
@@ -226,12 +226,13 @@ fn get_referenced_entities(config: &Config, entity: &str) -> HashSet<String> {
 mod test_helpers {
     use crate::Config;
 
+    #[allow(unused)]
     pub fn empty_config() -> Config {
         Config::new("", "").unwrap()
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, gotify, sendmail))]
 mod tests {
     use super::*;
     use crate::endpoints::gotify::{GotifyConfig, GotifyPrivateConfig};
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied-series: [PATCH proxmox 1/2] notify: fix build warnings if not all features are enabled
  2023-07-24 12:31 [pve-devel] [PATCH proxmox 1/2] notify: fix build warnings if not all features are enabled Lukas Wagner
  2023-07-24 12:31 ` [pve-devel] [PATCH proxmox 2/2] notify: fix tests " Lukas Wagner
@ 2023-07-28  8:45 ` Wolfgang Bumiller
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Bumiller @ 2023-07-28  8:45 UTC (permalink / raw)
  To: Lukas Wagner; +Cc: pve-devel

applied both patches, thanks




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-28  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 12:31 [pve-devel] [PATCH proxmox 1/2] notify: fix build warnings if not all features are enabled Lukas Wagner
2023-07-24 12:31 ` [pve-devel] [PATCH proxmox 2/2] notify: fix tests " Lukas Wagner
2023-07-28  8:45 ` [pve-devel] applied-series: [PATCH proxmox 1/2] notify: fix build warnings " Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal