From 04f9ab52fa0ee55185646b81a5480f41081d391c Mon Sep 17 00:00:00 2001 From: Tracewebstudio Dev Date: Sat, 18 Apr 2026 18:30:56 +0200 Subject: [PATCH] fix: suppress dead_code warnings with #[allow(dead_code)] --- apps/customers/src/handlers.rs | 4 ++-- apps/job_seekers/src/handlers.rs | 5 +++-- apps/leads/src/lead_requests.rs | 12 ++++++------ apps/payments/src/main.rs | 3 ++- apps/payments/src/packages.rs | 2 +- apps/users/src/handlers/admin_email.rs | 5 ++++- apps/users/src/handlers/ai.rs | 8 ++++---- apps/users/src/handlers/auth.rs | 1 + apps/users/src/handlers/config.rs | 1 + apps/users/src/handlers/coupons.rs | 1 + apps/users/src/handlers/kb.rs | 2 ++ apps/users/src/handlers/onboarding.rs | 2 +- apps/users/src/handlers/profile.rs | 2 +- apps/users/src/handlers/user_roles.rs | 1 - crates/db/src/models/user_role_profile.rs | 2 +- crates/email/src/lib.rs | 8 ++++---- 16 files changed, 34 insertions(+), 25 deletions(-) diff --git a/apps/customers/src/handlers.rs b/apps/customers/src/handlers.rs index e445a2b..f5edabf 100644 --- a/apps/customers/src/handlers.rs +++ b/apps/customers/src/handlers.rs @@ -122,7 +122,7 @@ async fn list_requirements( async fn create_requirement( State(state): State, - auth: AuthUser, + _auth: AuthUser, Json(payload): Json, ) -> impl IntoResponse { let p_date = payload.preferred_date.and_then(|d| chrono::NaiveDate::parse_from_str(&d, "%Y-%m-%d").ok()); @@ -256,7 +256,7 @@ async fn list_requests( async fn approve_request( State(state): State, Path(lead_id): Path, - auth: AuthUser, + _auth: AuthUser, ) -> impl IntoResponse { let lead = match LeadRequestRepository::get_by_id(&state.pool, lead_id).await { Ok(Some(l)) => l, diff --git a/apps/job_seekers/src/handlers.rs b/apps/job_seekers/src/handlers.rs index 665306d..9c00ba1 100644 --- a/apps/job_seekers/src/handlers.rs +++ b/apps/job_seekers/src/handlers.rs @@ -37,6 +37,7 @@ pub struct JobBrowseQuery { } #[derive(Deserialize)] +#[allow(dead_code)] pub struct ApplyRequest { pub cover_note: Option, pub resume_url: Option, @@ -278,7 +279,7 @@ async fn list_my_applications( auth: AuthUser, Query(q): Query, ) -> impl IntoResponse { - let seeker = match JobSeekerRepository::get_by_user_id(&state.pool, auth.user_id).await { + let _seeker = match JobSeekerRepository::get_by_user_id(&state.pool, auth.user_id).await { Ok(Some(s)) => s, _ => return (StatusCode::NOT_FOUND, "Job seeker profile not found").into_response(), }; @@ -300,7 +301,7 @@ async fn get_my_application( auth: AuthUser, Path(id): Path, ) -> impl IntoResponse { - let seeker = match JobSeekerRepository::get_by_user_id(&state.pool, auth.user_id).await { + let _seeker = match JobSeekerRepository::get_by_user_id(&state.pool, auth.user_id).await { Ok(Some(s)) => s, _ => return (StatusCode::NOT_FOUND, "Job seeker profile not found").into_response(), }; diff --git a/apps/leads/src/lead_requests.rs b/apps/leads/src/lead_requests.rs index 0e2efa1..0c91de7 100644 --- a/apps/leads/src/lead_requests.rs +++ b/apps/leads/src/lead_requests.rs @@ -131,7 +131,7 @@ async fn list_lead_requests( async fn send_lead_request( State(state): State>, - axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + axum::extract::ConnectInfo(_addr): axum::extract::ConnectInfo, Json(payload): Json, ) -> impl IntoResponse { let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap_or_default(); @@ -275,7 +275,7 @@ async fn send_lead_request( async fn accept_lead_request( State(state): State>, Path(id): Path, - axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + axum::extract::ConnectInfo(_addr): axum::extract::ConnectInfo, ) -> impl IntoResponse { let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap_or_default(); @@ -372,7 +372,7 @@ async fn accept_lead_request( async fn reject_lead_request( State(state): State>, Path(id): Path, - axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + axum::extract::ConnectInfo(_addr): axum::extract::ConnectInfo, ) -> impl IntoResponse { let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap_or_default(); @@ -436,7 +436,7 @@ async fn reject_lead_request( async fn my_requests( State(state): State>, Query(q): Query, - axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + axum::extract::ConnectInfo(_addr): axum::extract::ConnectInfo, ) -> impl IntoResponse { let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap_or_default(); let page = q.page.unwrap_or(1); @@ -476,7 +476,7 @@ async fn my_requests( async fn my_pending_requests( State(state): State>, - axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + axum::extract::ConnectInfo(_addr): axum::extract::ConnectInfo, ) -> impl IntoResponse { let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap_or_default(); @@ -506,7 +506,7 @@ async fn get_customer_lead_requests( State(state): State>, Path(lead_id): Path, Query(q): Query, - axum::extract::ConnectInfo(addr): axum::extract::ConnectInfo, + axum::extract::ConnectInfo(_addr): axum::extract::ConnectInfo, ) -> impl IntoResponse { let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap_or_default(); let page = q.page.unwrap_or(1); diff --git a/apps/payments/src/main.rs b/apps/payments/src/main.rs index 6490e9a..1f71eaf 100644 --- a/apps/payments/src/main.rs +++ b/apps/payments/src/main.rs @@ -15,7 +15,7 @@ use sqlx::FromRow; pub mod packages; #[derive(Clone)] -struct AppState { +pub struct AppState { beeceptor_url: String, client: reqwest::Client, pool: PgPool, @@ -66,6 +66,7 @@ struct PricingPackageRow { } #[derive(Debug, FromRow)] +#[allow(dead_code)] struct PaymentRow { id: Uuid, user_id: Uuid, diff --git a/apps/payments/src/packages.rs b/apps/payments/src/packages.rs index 0738001..90355de 100644 --- a/apps/payments/src/packages.rs +++ b/apps/payments/src/packages.rs @@ -271,7 +271,7 @@ async fn update_package( .fetch_optional(&state.pool) .await; - let existing = match existing { + let _existing = match existing { Ok(Some(e)) => e, Ok(None) => return (StatusCode::NOT_FOUND, "Package not found").into_response(), Err(e) => return (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response(), diff --git a/apps/users/src/handlers/admin_email.rs b/apps/users/src/handlers/admin_email.rs index 5eed7d9..155ce42 100644 --- a/apps/users/src/handlers/admin_email.rs +++ b/apps/users/src/handlers/admin_email.rs @@ -419,6 +419,7 @@ async fn send_test_email( // ── SMTP Configuration ─────────────────────────────────────────────────────── #[derive(Serialize, Deserialize)] +#[allow(dead_code)] struct SmtpConfig { host: String, port: i32, @@ -461,6 +462,7 @@ async fn get_smtp_config() -> impl IntoResponse { } #[derive(Deserialize)] +#[allow(dead_code)] struct UpdateSmtpConfigRequest { host: String, port: i32, @@ -507,6 +509,7 @@ struct SmtpTestRequest { } #[derive(Deserialize)] +#[allow(dead_code)] struct SmtpTestConfig { host: String, port: i32, @@ -542,7 +545,7 @@ async fn test_smtp_connection( } } -async fn create_test_mailer(config: SmtpTestConfig) -> email::Mailer { +async fn create_test_mailer(_config: SmtpTestConfig) -> email::Mailer { // This is a simplified version - in production you'd create a new Mailer instance // For now, we just return the default mailer email::Mailer::new() diff --git a/apps/users/src/handlers/ai.rs b/apps/users/src/handlers/ai.rs index 5935ae4..1b06f71 100644 --- a/apps/users/src/handlers/ai.rs +++ b/apps/users/src/handlers/ai.rs @@ -1,6 +1,6 @@ use crate::AppState; use axum::{ - extract::{Query, State}, + extract::State, http::StatusCode, response::IntoResponse, routing::{get, post}, @@ -45,7 +45,7 @@ struct OllamaGenerateResponse { response: String, } -async fn call_ollama(state: &AppState, model: &str, prompt: &str) -> Result { +async fn call_ollama(_state: &AppState, model: &str, prompt: &str) -> Result { let base_url = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://ollama.nxtgauge-ai.svc.cluster.local:11434".to_string()); let url = format!("{}/api/generate", base_url); @@ -288,7 +288,7 @@ struct ExtractedField { } async fn ai_extract_form( - State(state): State, + State(_state): State, Json(body): Json, ) -> impl IntoResponse { let ollama_base = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://ollama.nxtgauge-ai.svc.cluster.local:11434".to_string()); @@ -315,7 +315,7 @@ async fn ai_extract_form( .unwrap_or_else(|_| serde_json::json!({})); let mut fields = Vec::new(); - let mut missing_fields = Vec::new(); + let missing_fields = Vec::new(); if let Some(obj) = extracted.as_object() { for (key, value) in obj { diff --git a/apps/users/src/handlers/auth.rs b/apps/users/src/handlers/auth.rs index 11ffbf5..62dd5ba 100644 --- a/apps/users/src/handlers/auth.rs +++ b/apps/users/src/handlers/auth.rs @@ -34,6 +34,7 @@ pub fn router() -> Router { // ── DTOs ────────────────────────────────────────────────────────────────────── #[derive(Deserialize)] +#[allow(dead_code)] pub struct RegisterPayload { #[serde(default)] pub first_name: Option, diff --git a/apps/users/src/handlers/config.rs b/apps/users/src/handlers/config.rs index 91da10e..baa89db 100644 --- a/apps/users/src/handlers/config.rs +++ b/apps/users/src/handlers/config.rs @@ -239,6 +239,7 @@ async fn get_my_runtime_config( let role_key = auth.claims.active_role.clone().to_uppercase(); #[derive(sqlx::FromRow)] + #[allow(dead_code)] struct RoleRow { id: Uuid, key: String, diff --git a/apps/users/src/handlers/coupons.rs b/apps/users/src/handlers/coupons.rs index f700005..c3f3b2b 100644 --- a/apps/users/src/handlers/coupons.rs +++ b/apps/users/src/handlers/coupons.rs @@ -139,6 +139,7 @@ struct ExistingCouponRow { } #[derive(sqlx::FromRow)] +#[allow(dead_code)] struct ValidateCouponRow { id: Uuid, code: String, diff --git a/apps/users/src/handlers/kb.rs b/apps/users/src/handlers/kb.rs index 63202a3..f723cd3 100644 --- a/apps/users/src/handlers/kb.rs +++ b/apps/users/src/handlers/kb.rs @@ -523,6 +523,7 @@ async fn admin_delete_category( Path(id): Path, ) -> impl IntoResponse { #[derive(sqlx::FromRow)] + #[allow(dead_code)] struct IdRow { id: Uuid } let result = sqlx::query_as::<_, IdRow>( @@ -859,6 +860,7 @@ async fn admin_delete_article( Path(id): Path, ) -> impl IntoResponse { #[derive(sqlx::FromRow)] + #[allow(dead_code)] struct IdRow { id: Uuid } let result = sqlx::query_as::<_, IdRow>( diff --git a/apps/users/src/handlers/onboarding.rs b/apps/users/src/handlers/onboarding.rs index 019c35a..0b03307 100644 --- a/apps/users/src/handlers/onboarding.rs +++ b/apps/users/src/handlers/onboarding.rs @@ -267,7 +267,7 @@ async fn get_or_create_user_role_profile_id( pool: &sqlx::PgPool, user_id: uuid::Uuid, role_key: &str, - role_id: uuid::Uuid, + _role_id: uuid::Uuid, ) -> Result { if let Some(id) = sqlx::query_scalar::<_, uuid::Uuid>( r#"SELECT id FROM user_role_profiles WHERE user_id = $1 AND role_key = $2"#, diff --git a/apps/users/src/handlers/profile.rs b/apps/users/src/handlers/profile.rs index 6ad232b..3b400e5 100644 --- a/apps/users/src/handlers/profile.rs +++ b/apps/users/src/handlers/profile.rs @@ -521,7 +521,7 @@ async fn get_or_create_user_role_profile_id( return Ok(id); } - let role = RoleRepository::get_by_key(pool, role_key).await?; + let _role = RoleRepository::get_by_key(pool, role_key).await?; sqlx::query_scalar::<_, Uuid>( r#" diff --git a/apps/users/src/handlers/user_roles.rs b/apps/users/src/handlers/user_roles.rs index fb8078f..b30ee12 100644 --- a/apps/users/src/handlers/user_roles.rs +++ b/apps/users/src/handlers/user_roles.rs @@ -9,7 +9,6 @@ use axum::{ use contracts::auth_middleware::AuthUser; use db::models::role::RoleRepository; use serde::{Deserialize, Serialize}; -use uuid::Uuid; pub fn router() -> Router { Router::new() diff --git a/crates/db/src/models/user_role_profile.rs b/crates/db/src/models/user_role_profile.rs index 0735d1f..74de1ca 100644 --- a/crates/db/src/models/user_role_profile.rs +++ b/crates/db/src/models/user_role_profile.rs @@ -193,7 +193,7 @@ impl UserRoleProfileRepository { pub async fn approve( pool: &PgPool, id: Uuid, - approved_by: Uuid, + _approved_by: Uuid, ) -> Result { sqlx::query_as::<_, UserRoleProfile>( r#"UPDATE user_role_profiles SET diff --git a/crates/email/src/lib.rs b/crates/email/src/lib.rs index 3fadd1e..4cfbb64 100644 --- a/crates/email/src/lib.rs +++ b/crates/email/src/lib.rs @@ -1,6 +1,6 @@ use anyhow::Result; use lettre::{ - message::{header::ContentType, Mailbox, MultiPart, SinglePart}, + message::{header::ContentType, Mailbox}, transport::smtp::authentication::Credentials, AsyncSmtpTransport, AsyncTransport, Message, Tokio1Executor, }; @@ -453,7 +453,7 @@ impl Mailer { } pub async fn send_account_deleted_email(&self, to: &str, name: &str) -> Result<()> { - let vars = HashMap::from([ + let _vars = HashMap::from([ ("first_name", name), ]); // Use account-suspended template as base or create a simple message @@ -505,7 +505,7 @@ impl Mailer { } pub async fn send_lead_accepted_customer_email(&self, to: &str, customer_name: &str, professional_name: &str, professional_email: &str, professional_phone: &str) -> Result<()> { - let vars = HashMap::from([ + let _vars = HashMap::from([ ("first_name", customer_name), ("professional_name", professional_name), ("professional_email", professional_email), @@ -591,7 +591,7 @@ impl Mailer { } pub async fn send_support_ticket_resolved_email(&self, to: &str, name: &str, subject: &str) -> Result<()> { - let frontend_url = env::var("FRONTEND_URL").unwrap_or_else(|_| "https://nxtgauge.com".to_string()); + let _frontend_url = env::var("FRONTEND_URL").unwrap_or_else(|_| "https://nxtgauge.com".to_string()); let now = chrono::Local::now().format("%B %d, %Y").to_string(); let vars = HashMap::from([