From 13056242ab976b766bbff345d9b22e3aa9ad4a94 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 7 Jan 2025 21:48:22 +0100 Subject: Silence dead/unused code warnings in tests auth module switching implementation based on cfg(test) --- server/src/auth.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/auth.rs b/server/src/auth.rs index c76bd82..4889f78 100644 --- a/server/src/auth.rs +++ b/server/src/auth.rs @@ -50,7 +50,7 @@ struct Login<'r> { } #[derive(Debug, Deserialize)] -#[allow(dead_code)] +#[cfg_attr(test, allow(dead_code))] struct AuthConfig<'a> { session_max_age_days: u32, ldap_url: Cow<'a, str>, @@ -67,6 +67,7 @@ struct Sessions { data: Mutex, } +#[cfg_attr(test, allow(dead_code))] struct LdapState { ldap: OnceLock, } @@ -283,6 +284,7 @@ fn unauthorized() -> Json { Json(STATUS_UNAUTHORIZED) } +#[cfg_attr(test, allow(dead_code))] async fn setup_ldap( ldap_state: &LdapState, config: &AuthConfig<'_>, @@ -304,6 +306,7 @@ enum LdapOrSqlError { SqlError(sqlx::Error), } +#[cfg_attr(test, allow(dead_code))] async fn sync_ldap( ldap_state: &LdapState, config: &AuthConfig<'_>, -- cgit v1.2.3-70-g09d2