From ba395543e4910e42502aa1058a89ba9abe26d827 Mon Sep 17 00:00:00 2001 From: prplV Date: Tue, 3 Dec 2024 13:06:17 +0300 Subject: [PATCH] no warnings --- src/utils/hagent.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/utils/hagent.rs b/src/utils/hagent.rs index 06cb173..068dbeb 100644 --- a/src/utils/hagent.rs +++ b/src/utils/hagent.rs @@ -1,6 +1,10 @@ +// // module needed to check host-agent health condition and to communicate with it +// use tokio::{io::Interest, net::UnixStream}; use anyhow::{Ok, Result, Error}; +// to kill lint bug +#[allow(unused_imports)] use tokio::net::UnixListener; /// # Fn `open_unix_socket` @@ -16,6 +20,7 @@ use tokio::net::UnixListener; /// /// *depends on* : - /// +#[allow(dead_code)] async fn open_unix_socket(sock_path: &str) -> Result { // "/var/run/enode/hostagent.sock" UnixStream::connect(sock_path).await @@ -34,6 +39,7 @@ async fn open_unix_socket(sock_path: &str) -> Result /// /// *depends on* : - /// +#[allow(dead_code)] async fn ha_healthcheck(socket: &UnixStream) -> Result<(), Error> { socket.ready(Interest::WRITABLE).await?; socket.writable().await?; @@ -54,6 +60,7 @@ async fn ha_healthcheck(socket: &UnixStream) -> Result<(), Error> { /// /// *depends on* : - /// +#[allow(dead_code)] async fn ha_send_data(socket: &UnixStream, data: &str) -> Result<(), Error > { socket.ready(Interest::WRITABLE).await?; socket.writable().await?; @@ -74,10 +81,10 @@ mod hagent_unittets { // maybe bool : true -> alive, false -> dead // simple request on api async fn hagent_healthcheck() { - let mut list = init_listener().await; + let _ = init_listener().await; let sock = open_unix_socket(TEST_SOCKET).await; assert!(sock.is_ok()); - let mut sock = sock.unwrap(); + let sock = sock.unwrap(); assert!(ha_healthcheck(&sock).await.is_ok()); } #[tokio::test] @@ -91,17 +98,17 @@ mod hagent_unittets { let metrics = Metrics::new(contm, vec![procm]); let metrics = &serde_json::to_string_pretty(&metrics).unwrap(); - let mut list = init_listener().await; + let _ = init_listener().await; let sock = open_unix_socket(TEST_SOCKET).await; assert!(sock.is_ok()); - let mut sock = sock.unwrap(); + let sock = sock.unwrap(); assert!(ha_healthcheck(&sock).await.is_ok()); assert!(ha_send_data(&sock, &metrics).await.is_ok()); } #[tokio::test] async fn open_unixsocket_test() { - let mut list = init_listener().await; + let _ = init_listener().await; assert!(open_unix_socket(TEST_SOCKET).await.is_ok()); } }