notify: fix build warnings if not all features are enabled

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
Lukas Wagner 2023-07-24 14:31:24 +02:00 committed by Wolfgang Bumiller
parent 1e095e5ab8
commit f6fa851d1f
4 changed files with 5 additions and 1 deletions

View File

@ -87,7 +87,8 @@ fn verify_digest(config: &Config, digest: Option<&[u8]>) -> Result<(), ApiError>
Ok(()) 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; let mut exists = false;
#[cfg(feature = "sendmail")] #[cfg(feature = "sendmail")]

View File

@ -57,6 +57,7 @@ fn config_init() -> SectionConfig {
} }
fn private_config_init() -> SectionConfig { fn private_config_init() -> SectionConfig {
#[allow(unused_mut)]
let mut config = SectionConfig::new(&BACKEND_NAME_SCHEMA); let mut config = SectionConfig::new(&BACKEND_NAME_SCHEMA);
#[cfg(feature = "gotify")] #[cfg(feature = "gotify")]

View File

@ -14,6 +14,7 @@ pub fn set_context(context: &'static dyn Context) {
CONTEXT.set(context).expect("context has already been set"); 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 { pub(crate) fn context() -> &'static dyn Context {
*CONTEXT.get().expect("context has not been yet") *CONTEXT.get().expect("context has not been yet")
} }

View File

@ -226,6 +226,7 @@ macro_rules! parse_endpoints_without_private_config {
impl Bus { impl Bus {
/// Instantiate notification bus from a given configuration. /// Instantiate notification bus from a given configuration.
pub fn from_config(config: &Config) -> Result<Self, Error> { pub fn from_config(config: &Config) -> Result<Self, Error> {
#[allow(unused_mut)]
let mut endpoints = HashMap::new(); let mut endpoints = HashMap::new();
// Instantiate endpoints // Instantiate endpoints