From 989edb8eff99bd855c69fb177f45b4f8bd43bea6 Mon Sep 17 00:00:00 2001 From: Gabriele Baldoni Date: Tue, 10 Dec 2024 17:04:38 +0100 Subject: [PATCH] chore: make clippy happy Signed-off-by: Gabriele Baldoni --- Cargo.toml | 2 +- src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7f6694a..645fc42 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tokio = {version = "1.17.0", features = ["io-util", "time"] } +tokio = {version = "1.17.0", features = ["io-util", "time", "fs"] } tokio-serial = "5.4.1" futures = "0.3.21" cobs = "0.2" diff --git a/src/lib.rs b/src/lib.rs index dd11ff6..5819c91 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -427,14 +427,14 @@ impl ZSerial { async fn check_device(&self) -> tokio_serial::Result<()> { // check if the file is still there - if !tokio::fs::metadata(self.port.clone()).await.is_ok() { + if tokio::fs::metadata(self.port.clone()).await.is_err() { // the file does not exist anymore returing an error return Err(tokio_serial::Error::new( tokio_serial::ErrorKind::NoDevice, - format!("Serial device disappeared"), + "Serial device disappeared".to_string(), )); } - return Ok(()); + Ok(()) } async fn internal_read(&mut self, buff: &mut [u8]) -> tokio_serial::Result<(usize, Header)> { //check if the device is sitll there