From 07fe0ca00338a6a71d7c28c487e43229e8e910c1 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 27 May 2024 19:20:19 +0100 Subject: [PATCH] Ran Clippy --- src/main.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index 280e045..f5cc080 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,8 +67,8 @@ struct SysInfo { } fn get_system_info( - network_if_names: &Vec, - mount_names: &Vec, + network_if_names: &[String], + mount_names: &[String], temperature_sensors: &Vec>, ) -> SysInfo { let mut sys = System::new_all(); @@ -84,7 +84,7 @@ fn get_system_info( let mut disks_context = Vec::new(); for disk in disks.list() { let mount_point = disk.mount_point().display().to_string(); - if mount_names.len() != 0 && !mount_names.contains(&mount_point) { + if !mount_names.is_empty() && !mount_names.contains(&mount_point) { continue; } let ts = disk.total_space(); @@ -96,7 +96,7 @@ fn get_system_info( available_space: Byte::from(ass).to_string(), available_space_bytes: ass, consumed_space_bytes: ts - ass, - mount_point: mount_point, + mount_point, }); } @@ -113,7 +113,7 @@ fn get_system_info( }); } } - if temperature_sensors.len() == 0 { + if temperature_sensors.is_empty() { components_context.push(ComponentInfo { name: component_name, temperature: component.temperature() as u8, @@ -124,7 +124,7 @@ fn get_system_info( let mut network_ifs = Vec::new(); let mut network_ifs_errored = Vec::new(); for network_if_name in network_if_names { - match Vnstat::get(&network_if_name) { + match Vnstat::get(network_if_name) { Ok(vns) => { network_ifs.push(NetworkInfo { name: network_if_name.to_string(), @@ -150,8 +150,8 @@ fn get_system_info( total_swap_pretty: Byte::from(sys.total_swap()).to_string(), used_swap_pretty: Byte::from(sys.used_swap()).to_string(), }, - network_ifs: network_ifs, - network_ifs_errored: network_ifs_errored, + network_ifs, + network_ifs_errored, hostname: System::host_name(), operating_system: System::long_os_version(), uptime: UptimeFull::from(System::uptime()).to_string(), @@ -227,10 +227,10 @@ fn get_latest_twenty_blocks(json_rpc_url: &str, current_height: u64) -> Vec) -> Template { node_info: node_info, latest_twenty_blocks: latest_twenty_blocks, }; - Template::render("index", &context) + Template::render("index", context) } #[launch]