From bc419b109d8a6d1c82070fe5f61efd6af56a4530 Mon Sep 17 00:00:00 2001 From: DeFiDude <59237470+DeFiDude@users.noreply.github.com> Date: Thu, 6 Aug 2026 18:49:06 -0600 Subject: [PATCH] ci: enforce strict Clippy across supported targets --- .github/workflows/ci.yml | 18 ++++++++++-------- crates/rns-interface/src/android_usb.rs | 14 +++++++------- crates/rns-interface/src/auto.rs | 1 - crates/rns-interface/src/weave.rs | 1 - crates/rns-protocol/src/resource.rs | 4 ++-- crates/rns-runtime/src/interface_registry.rs | 10 ++++------ 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3260e2..2a6ebea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,12 +28,12 @@ jobs: if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install -y libudev-dev libdbus-1-dev pkg-config - name: Test (default features) - run: cargo test --workspace + run: cargo test --workspace --locked - name: Build application examples - run: cargo build -p rns-runtime --examples + run: cargo build -p rns-runtime --examples --locked - name: Test BLE interface features (Linux/macOS) if: runner.os != 'Windows' - run: cargo test -p rns-interface --features ble + run: cargo test -p rns-interface --features ble --locked lint: name: Lint @@ -47,13 +47,12 @@ jobs: - name: Install system deps run: sudo apt-get update && sudo apt-get install -y libudev-dev libdbus-1-dev pkg-config - run: cargo fmt --all -- --check - - run: cargo clippy --workspace --all-targets -- -D warnings - - run: cargo clippy -p rns-interface --features ble --all-targets -- -D warnings + - run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings - name: Check public API documentation env: RUSTDOCFLAGS: "-D warnings" - run: cargo doc --workspace --no-deps - - run: cargo check --workspace --no-default-features + run: cargo doc --workspace --no-deps --locked + - run: cargo check --workspace --no-default-features --locked msrv: name: Rust 1.85 MSRV @@ -62,9 +61,12 @@ jobs: steps: - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@1.85.0 + with: + components: clippy - uses: Swatinem/rust-cache@v2 with: cache-bin: false - name: Install system deps run: sudo apt-get update && sudo apt-get install -y libudev-dev libdbus-1-dev pkg-config - - run: cargo check --workspace --all-targets + - name: Clippy (all targets and features) + run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings diff --git a/crates/rns-interface/src/android_usb.rs b/crates/rns-interface/src/android_usb.rs index d690b76..a5262cc 100644 --- a/crates/rns-interface/src/android_usb.rs +++ b/crates/rns-interface/src/android_usb.rs @@ -608,13 +608,13 @@ fn drop_worker_global_refs_attached( ) { let connection = connection.take(); let endpoint = endpoint.take(); - if let Some(vm) = JAVA_VM.get() - && let Ok(env) = vm.attach_current_thread() - { - drop(endpoint); - drop(connection); - drop(env); - return; + if let Some(vm) = JAVA_VM.get() { + if let Ok(env) = vm.attach_current_thread() { + drop(endpoint); + drop(connection); + drop(env); + return; + } } drop(endpoint); drop(connection); diff --git a/crates/rns-interface/src/auto.rs b/crates/rns-interface/src/auto.rs index acbf303..cc54cee 100644 --- a/crates/rns-interface/src/auto.rs +++ b/crates/rns-interface/src/auto.rs @@ -2004,7 +2004,6 @@ mod tests { #[test] fn test_constants() { assert_eq!(HW_MTU, 1196); - const { assert!(FIXED_MTU) }; assert_eq!(DISCOVERY_PORT, 29716); assert_eq!(DATA_PORT, 42671); assert_eq!(UNICAST_DISCOVERY_PORT, 29717); diff --git a/crates/rns-interface/src/weave.rs b/crates/rns-interface/src/weave.rs index 4a4bb2c..851e1ac 100644 --- a/crates/rns-interface/src/weave.rs +++ b/crates/rns-interface/src/weave.rs @@ -336,7 +336,6 @@ mod tests { #[test] fn test_weave_constants() { assert_eq!(HW_MTU, 1024); - const { assert!(FIXED_MTU) }; assert_eq!(PEERING_TIMEOUT, 20.0); assert_eq!(BITRATE_GUESS, 250_000); assert_eq!(DEFAULT_IFAC_SIZE, 16); diff --git a/crates/rns-protocol/src/resource.rs b/crates/rns-protocol/src/resource.rs index 702b805..30d0d31 100644 --- a/crates/rns-protocol/src/resource.rs +++ b/crates/rns-protocol/src/resource.rs @@ -612,8 +612,8 @@ impl InboundResource { tracing::trace!( result = %format!("{:02x}{:02x}{:02x}{:02x}", mh[0], mh[1], mh[2], mh[3]), data_len = data.len(), - data_first16 = %data.iter().take(16).map(|b| format!("{:02x}", b)).collect::(), - random_hash = %self.random_hash.iter().map(|b| format!("{:02x}", b)).collect::(), + data_first16 = %hex::encode(&data[..data.len().min(16)]), + random_hash = %hex::encode(self.random_hash), random_len = self.random_hash.len(), "resource part map hash" ); diff --git a/crates/rns-runtime/src/interface_registry.rs b/crates/rns-runtime/src/interface_registry.rs index 7dd0f6d..dac31dd 100644 --- a/crates/rns-runtime/src/interface_registry.rs +++ b/crates/rns-runtime/src/interface_registry.rs @@ -849,12 +849,10 @@ impl Drop for InterfaceRegistration { stop_owned_task(&mut task, &mut driver, Some(id)).await; registry.mark_abandoned_pending(id, owner); }); - } else { - if let Some(driver) = driver.take() { - driver.request_shutdown(); - } else if let Some(task) = task.take() { - task.abort(); - } + } else if let Some(driver) = driver.take() { + driver.request_shutdown(); + } else if let Some(task) = task.take() { + task.abort(); } // The exact owner remains fail-closed until the detached cleanup has // joined the task. During a runtime drain the coordinator claims the