From 37d623bd12e8a12fc9cb42b55cd78c63de9c9f95 Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Thu, 30 Jan 2025 09:06:38 +0000 Subject: [PATCH] Clippy --- src/rmt.rs | 2 +- src/uart.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rmt.rs b/src/rmt.rs index 700ef372b8c..e723912a61a 100644 --- a/src/rmt.rs +++ b/src/rmt.rs @@ -642,7 +642,7 @@ impl VariableLengthSignal { /// - `capacity` is the number of [`Pulse`]s which can be pushes before reallocating pub fn with_capacity(capacity: usize) -> Self { // half the size, rounding up, because each entry in the [`Vec`] holds upto 2 pulses each - let vec_size = (capacity + 1) / 2; + let vec_size = capacity.div_ceil(2); Self { items: alloc::vec::Vec::with_capacity(vec_size), next_item_is_new: true, diff --git a/src/uart.rs b/src/uart.rs index c25a4060ec8..9673a9108d4 100644 --- a/src/uart.rs +++ b/src/uart.rs @@ -2098,7 +2098,12 @@ impl Owner { Owner::Borrowed => false, Owner::Shared => REFS[port as usize].fetch_sub(1, Ordering::SeqCst) == 0, }; - needs_drop.then(|| delete_driver(port)).unwrap_or(Ok(())) + + if needs_drop { + delete_driver(port) + } else { + Ok(()) + } } }