satisfied cargo clippy

This commit is contained in:
2025-08-09 22:12:49 +02:00
parent cab92df37e
commit 72a260c65f
5 changed files with 15 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ use crate::models::{HeartbeatDto, IdResponse, MetricDto, RegistrationDto};
use anyhow::Result; use anyhow::Result;
use reqwest::{Client, StatusCode}; use reqwest::{Client, StatusCode};
use std::error::Error; use std::error::Error;
use tokio::time::{interval, sleep}; use tokio::time::sleep;
pub async fn register_with_server( pub async fn register_with_server(
base_url: &str, base_url: &str,

View File

@@ -21,7 +21,7 @@ pub struct HardwareInfo {
pub memory: memory::MemoryInfo, pub memory: memory::MemoryInfo,
pub disk: disk::DiskInfo, pub disk: disk::DiskInfo,
pub network: network::NetworkInfo, pub network: network::NetworkInfo,
network_monitor: network::NetworkMonitor, pub network_monitor: network::NetworkMonitor,
} }
impl HardwareInfo { impl HardwareInfo {

View File

@@ -16,6 +16,12 @@ pub struct NetworkMonitor {
last_update: Instant, last_update: Instant,
} }
impl Default for NetworkMonitor {
fn default() -> Self {
Self::new()
}
}
impl NetworkMonitor { impl NetworkMonitor {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {

View File

@@ -32,7 +32,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
Ok((id, ip)) => (id, ip), Ok((id, ip)) => (id, ip),
Err(e) => { Err(e) => {
eprintln!("Fehler bei der Registrierung am Server: {e}"); eprintln!("Fehler bei der Registrierung am Server: {e}");
return Err(e.into()); return Err(e);
} }
}; };
@@ -59,12 +59,11 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let (heartbeat_handle, metrics_handle) = let (heartbeat_handle, metrics_handle) =
tokio::try_join!(flatten(heartbeat_handle), flatten(metrics_handle))?; tokio::try_join!(flatten(heartbeat_handle), flatten(metrics_handle))?;
match (heartbeat_handle, metrics_handle) { let (heartbeat, metrics) = (heartbeat_handle, metrics_handle);
(heartbeat, metrics) => println!( println!(
"All tasks completed successfully: {:?}, {:?}.", "All tasks completed successfully: {:?}, {:?}.",
heartbeat, metrics heartbeat, metrics
), );
}
println!("All tasks completed successfully."); println!("All tasks completed successfully.");

View File

@@ -45,7 +45,7 @@ impl Collector {
Ok(hw) => hw, Ok(hw) => hw,
Err(e) => { Err(e) => {
eprintln!("Fehler beim Sammeln der Hardware-Infos: {e}"); eprintln!("Fehler beim Sammeln der Hardware-Infos: {e}");
return Err(e.into()); return Err(e);
} }
}; };
// Collect network usage // Collect network usage