From 4b6292e0c34071a2d9eef811b359c53e5127943a Mon Sep 17 00:00:00 2001 From: Max Mayfield Date: Sun, 1 Mar 2026 17:15:31 +0000 Subject: [PATCH] Fix P1 Rust: remove all unused imports, variables, and fields across api/worker bins --- products/01-llm-cost-router/src/api/handler.rs | 9 ++++----- products/01-llm-cost-router/src/worker/anomaly.rs | 2 +- products/01-llm-cost-router/src/worker/digest.rs | 4 ++-- products/01-llm-cost-router/src/worker/main.rs | 9 ++++----- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/products/01-llm-cost-router/src/api/handler.rs b/products/01-llm-cost-router/src/api/handler.rs index fef96f2..56528d1 100644 --- a/products/01-llm-cost-router/src/api/handler.rs +++ b/products/01-llm-cost-router/src/api/handler.rs @@ -2,7 +2,7 @@ use axum::{ extract::{Path, Query, State}, http::{HeaderMap, StatusCode}, response::IntoResponse, - routing::{get, post, put, delete}, + routing::{get, put, delete}, Json, Router, }; use serde::{Deserialize, Serialize}; @@ -16,7 +16,7 @@ pub struct ApiState { pub auth: Arc, pub pg_pool: sqlx::PgPool, pub ts_pool: sqlx::PgPool, - pub config: Arc, + pub _config: Arc, } pub fn create_api_router(state: Arc) -> Router { @@ -47,7 +47,7 @@ async fn health() -> &'static str { "ok" } #[derive(Deserialize)] pub struct TimeRange { pub from: Option, - pub to: Option, + pub _to: Option, pub interval: Option, // "hour" or "day" } @@ -76,7 +76,7 @@ async fn get_analytics_summary( Query(range): Query, ) -> Result, ApiError> { let auth = state.auth.authenticate(&headers).await?; - let from = range.from.unwrap_or_else(|| "now() - interval '7 days'".to_string()); + let _from = range.from.unwrap_or_else(|| "now() - interval '7 days'".to_string()); let row = sqlx::query_as::<_, (i64, f64, f64, f64, i32, i32, i64, i64, i64)>( "SELECT @@ -494,7 +494,6 @@ async fn upsert_provider( .unwrap_or_else(|_| vec![0u8; 32]); use aes_gcm::{Aes256Gcm, KeyInit, aead::Aead}; - use aes_gcm::aead::OsRng; use aes_gcm::Nonce; let cipher = Aes256Gcm::new_from_slice(&key_bytes) diff --git a/products/01-llm-cost-router/src/worker/anomaly.rs b/products/01-llm-cost-router/src/worker/anomaly.rs index f3075f0..a64045d 100644 --- a/products/01-llm-cost-router/src/worker/anomaly.rs +++ b/products/01-llm-cost-router/src/worker/anomaly.rs @@ -1,5 +1,5 @@ use sqlx::PgPool; -use tracing::{info, warn}; +use tracing::warn; use uuid::Uuid; async fn get_org_owner_email(pool: &PgPool, org_id: Uuid) -> Result { diff --git a/products/01-llm-cost-router/src/worker/digest.rs b/products/01-llm-cost-router/src/worker/digest.rs index bb0ef01..f45465b 100644 --- a/products/01-llm-cost-router/src/worker/digest.rs +++ b/products/01-llm-cost-router/src/worker/digest.rs @@ -1,4 +1,4 @@ -use chrono::{DateTime, Datelike, NaiveTime, Utc, Weekday}; +use chrono::{DateTime, Datelike, NaiveTime, Utc}; use sqlx::PgPool; use tracing::{info, warn}; use uuid::Uuid; @@ -23,7 +23,7 @@ pub fn next_monday_9am(from: DateTime) -> DateTime { #[derive(Debug)] pub struct DigestData { - pub org_id: Uuid, + pub _org_id: Uuid, pub org_name: String, pub total_requests: i64, pub total_cost_original: f64, diff --git a/products/01-llm-cost-router/src/worker/main.rs b/products/01-llm-cost-router/src/worker/main.rs index 697bd4f..2e30b55 100644 --- a/products/01-llm-cost-router/src/worker/main.rs +++ b/products/01-llm-cost-router/src/worker/main.rs @@ -1,9 +1,8 @@ use std::sync::Arc; -use tokio::sync::mpsc; -use tracing::{info, warn, error}; -use chrono::{Utc, Duration}; +use tracing::{info, error}; +use chrono::Utc; -use dd0c_route::{AppConfig, TelemetryEvent}; +use dd0c_route::AppConfig; mod digest; mod anomaly; @@ -63,7 +62,7 @@ async fn main() -> anyhow::Result<()> { // Spawn periodic tasks let ts1 = ts_pool.clone(); let pg1 = pg_pool.clone(); - let config1 = config.clone(); + let _config1 = config.clone(); // Hourly: check for cost anomalies tokio::spawn(async move {