From 3d58f92ad384998c4e2c71f6363c782bc9639a85 Mon Sep 17 00:00:00 2001 From: Guillaume Binet Date: Sun, 22 Dec 2024 11:26:22 -0600 Subject: [PATCH] clippy: switch to warn as error (#179) * switch to warn as error * Should be all the remaining fixes. --- .github/workflows/general.yml | 4 ++-- components/payloads/cu_sensor_payloads/src/lib.rs | 2 +- components/tasks/cu_aligner/src/buffers.rs | 8 +++----- core/cu29_runtime/src/copperlist.rs | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/general.yml b/.github/workflows/general.yml index e711f03bd..2200b2722 100644 --- a/.github/workflows/general.yml +++ b/.github/workflows/general.yml @@ -59,11 +59,11 @@ jobs: # This is also relatively quick to do, so let's fail early. - name: Run clippy in debug if: runner.os == 'Linux' - run: cargo clippy --workspace --all-targets -- -W warning + run: cargo clippy --workspace --all-targets -- --deny warnings - name: Run clippy in release if: runner.os == 'Linux' - run: cargo clippy --release --workspace --all-targets -- -W warning + run: cargo clippy --release --workspace --all-targets -- --deny warnings - name: Install cargo-generate run: cargo install cargo-generate diff --git a/components/payloads/cu_sensor_payloads/src/lib.rs b/components/payloads/cu_sensor_payloads/src/lib.rs index 7d56559bc..19805970c 100644 --- a/components/payloads/cu_sensor_payloads/src/lib.rs +++ b/components/payloads/cu_sensor_payloads/src/lib.rs @@ -188,7 +188,7 @@ mod tests { let mut encoded = vec![0u8; 1024]; // Reserve a buffer with sufficient capacity let length = - bincode::encode_into_slice(&a, &mut encoded, bincode::config::standard()).unwrap(); + bincode::encode_into_slice(a, &mut encoded, bincode::config::standard()).unwrap(); assert_eq!(length, 4); } } diff --git a/components/tasks/cu_aligner/src/buffers.rs b/components/tasks/cu_aligner/src/buffers.rs index 4fc1e6548..b6eebd7d9 100644 --- a/components/tasks/cu_aligner/src/buffers.rs +++ b/components/tasks/cu_aligner/src/buffers.rs @@ -141,9 +141,7 @@ macro_rules! alignment_buffers { .min(); // If there is no data in any of the buffers, return early - if most_recent_time.is_none() { - return None; - } + most_recent_time?; let most_recent_time = most_recent_time.unwrap(); @@ -184,11 +182,11 @@ mod tests { buffers.buffer1.inner.push_back(msg1.clone()); buffers.buffer2.inner.push_back(msg1); // within the horizon - let _ = buffers.purge(Duration::from_secs(2).into()); + buffers.purge(Duration::from_secs(2).into()); assert_eq!(buffers.buffer1.inner.len(), 1); assert_eq!(buffers.buffer2.inner.len(), 1); // outside the horizon - let _ = buffers.purge(Duration::from_secs(5).into()); + buffers.purge(Duration::from_secs(5).into()); assert_eq!(buffers.buffer1.inner.len(), 0); assert_eq!(buffers.buffer2.inner.len(), 0); } diff --git a/core/cu29_runtime/src/copperlist.rs b/core/cu29_runtime/src/copperlist.rs index ebf115c2f..0b3c5165e 100644 --- a/core/cu29_runtime/src/copperlist.rs +++ b/core/cu29_runtime/src/copperlist.rs @@ -352,9 +352,9 @@ mod tests { assert_eq!(q.len(), 3); let mut iter = q.iter(); - iter.next().unwrap().msgs; - iter.next().unwrap().msgs; - iter.next().unwrap().msgs; + iter.next().unwrap(); + iter.next().unwrap(); + iter.next().unwrap(); assert!(iter.next().is_none()); }