From 97736ea4b8fdfb8accf9e93294eebcceeb6f8ede Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 9 Jan 2026 13:41:48 -0600 Subject: [PATCH] fix build errors --- src/api_client.rs | 10 ++-------- src/buffer/storage.rs | 7 ++----- src/poller/scheduler.rs | 9 +++++---- src/snmp/client.rs | 1 + src/snmp/mod.rs | 1 - src/snmp/types.rs | 2 ++ 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/api_client.rs b/src/api_client.rs index 435a200..8878ad6 100644 --- a/src/api_client.rs +++ b/src/api_client.rs @@ -41,10 +41,7 @@ impl ApiClient { .context("Failed to send config request")?; if !response.status().is_success() { - anyhow::bail!( - "Config request failed with status: {}", - response.status() - ); + anyhow::bail!("Config request failed with status: {}", response.status()); } let config: AgentConfig = response @@ -96,10 +93,7 @@ impl ApiClient { .context("Failed to send heartbeat request")?; if !response.status().is_success() { - anyhow::bail!( - "Heartbeat failed with status: {}", - response.status() - ); + anyhow::bail!("Heartbeat failed with status: {}", response.status()); } Ok(()) diff --git a/src/buffer/storage.rs b/src/buffer/storage.rs index f2f73c4..ccae0b6 100644 --- a/src/buffer/storage.rs +++ b/src/buffer/storage.rs @@ -57,11 +57,7 @@ impl Storage { conn.execute( "INSERT INTO metrics (metric_type, data, timestamp) VALUES (?1, ?2, ?3)", - params![ - metric.metric_type(), - data, - metric.timestamp().to_rfc3339() - ], + params![metric.metric_type(), data, metric.timestamp().to_rfc3339()], ) .context("Failed to insert metric")?; @@ -125,6 +121,7 @@ impl Storage { } /// Get the last poll time for equipment + #[allow(dead_code)] // Used in full SNMP implementation pub fn get_last_poll_time(&self, equipment_id: &str) -> Result>> { let conn = self.conn.lock().unwrap(); diff --git a/src/poller/scheduler.rs b/src/poller/scheduler.rs index 90e9165..e6cbef1 100644 --- a/src/poller/scheduler.rs +++ b/src/poller/scheduler.rs @@ -101,7 +101,10 @@ impl Scheduler { Ok(()) } Err(e) => { - warn!("Failed to fetch config, continuing with cached config: {}", e); + warn!( + "Failed to fetch config, continuing with cached config: {}", + e + ); Err(e) } } @@ -168,9 +171,7 @@ impl Scheduler { // Check if it's time to poll this equipment let should_poll = match poll_times.get(&equipment.id) { Some(last_poll) => { - let elapsed = Utc::now() - .signed_duration_since(*last_poll) - .num_seconds() as u64; + let elapsed = Utc::now().signed_duration_since(*last_poll).num_seconds() as u64; elapsed >= equipment.poll_interval_seconds } None => true, // Never polled before diff --git a/src/snmp/client.rs b/src/snmp/client.rs index de60508..6131bea 100644 --- a/src/snmp/client.rs +++ b/src/snmp/client.rs @@ -39,6 +39,7 @@ impl SnmpClient { /// Perform an SNMP WALK operation to get multiple values /// /// TODO: Complete SNMP library integration with proper walk implementation + #[allow(dead_code)] // Used in full SNMP implementation pub async fn walk( &self, ip_address: &str, diff --git a/src/snmp/mod.rs b/src/snmp/mod.rs index 4cff113..725e8e6 100644 --- a/src/snmp/mod.rs +++ b/src/snmp/mod.rs @@ -2,4 +2,3 @@ mod client; mod types; pub use client::SnmpClient; -pub use types::*; diff --git a/src/snmp/types.rs b/src/snmp/types.rs index 7e6dfa8..9ea353f 100644 --- a/src/snmp/types.rs +++ b/src/snmp/types.rs @@ -1,5 +1,6 @@ use thiserror::Error; +#[allow(dead_code)] // Some variants used only in full SNMP implementation #[derive(Debug, Error)] pub enum SnmpError { #[error("SNMP request failed: {0}")] @@ -21,6 +22,7 @@ pub enum SnmpError { pub type SnmpResult = Result; /// SNMP value returned from a GET operation +#[allow(dead_code)] // All variants used in full SNMP implementation #[derive(Debug, Clone)] pub enum SnmpValue { Integer(i64),