From 074ec5045117301e5ac93d93fc0f8f1feb9fdffb Mon Sep 17 00:00:00 2001 From: Salvatore Testa Date: Thu, 1 Feb 2024 14:24:32 -0800 Subject: [PATCH 1/2] Resolve `cargo clippy` errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here was the error. ``` ❯ cargo clippy Checking veilid-tools v0.2.5 (~/Developer/veilid/veilid-tools) error: this `MutexGuard` is held across an `await` point --> veilid-tools/src/tests/common/test_host_interface.rs:269:17 | 269 | let mut tick = tick_1.lock(); | ^^^^^^^^ | = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await note: these are all the `await` points this lock is held through --> veilid-tools/src/tests/common/test_host_interface.rs:271:25 | 271 | sleep(1000).await; | ^^^^^ ... 274 | sleep(1000).await; | ^^^^^ ... 277 | sleep(1000).await; | ^^^^^ ... 280 | sleep(1000).await; | ^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock note: the lint level is defined here --> veilid-tools/src/lib.rs:23:9 | 23 | #![deny(clippy::all)] | ^^^^^^^^^^^ = note: `#[deny(clippy::await_holding_lock)]` implied by `#[deny(clippy::all)]` error: could not compile `veilid-tools` (lib) due to previous error ``` --- veilid-tools/src/tests/common/test_host_interface.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/veilid-tools/src/tests/common/test_host_interface.rs b/veilid-tools/src/tests/common/test_host_interface.rs index 43b9b3a8..f694e866 100644 --- a/veilid-tools/src/tests/common/test_host_interface.rs +++ b/veilid-tools/src/tests/common/test_host_interface.rs @@ -259,6 +259,7 @@ pub async fn test_interval() { stopper.await; } +#[allow(clippy::await_holding_lock)] pub async fn test_timeout() { info!("testing timeout"); From 205be49eec27af9e9911e263ff81206d3c39a260 Mon Sep 17 00:00:00 2001 From: Salvatore Testa Date: Fri, 2 Feb 2024 11:03:03 -0800 Subject: [PATCH 2/2] Run `cargo clippy` with unit tests --- Earthfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Earthfile b/Earthfile index 8d4cb1c4..14d3506e 100644 --- a/Earthfile +++ b/Earthfile @@ -170,6 +170,7 @@ build-android: unit-tests-linux: FROM +code-linux ENV RUST_BACKTRACE=1 + RUN cargo clippy RUN cargo test -p veilid-server -p veilid-cli -p veilid-tools -p veilid-core # TODO: Change t0 cross so that they work on any platform