some clippy fixes

This commit is contained in:
Robin Müller 2025-01-10 17:19:28 +01:00
parent cf55fe1504
commit f438e7e40f
Signed by: muellerr
GPG Key ID: A649FB78196E3849
6 changed files with 17 additions and 14 deletions

View File

@ -35,6 +35,8 @@ features = ["critical-section"]
[dependencies.ringbuf] [dependencies.ringbuf]
version = "0.4.7" version = "0.4.7"
default-features = false default-features = false
git = "https://github.com/robamu/ringbuf.git"
branch = "remove-mut-on-split-ref"
features = ["portable-atomic"] features = ["portable-atomic"]
[dependencies.va108xx-hal] [dependencies.va108xx-hal]

View File

@ -12,7 +12,7 @@ use ringbuf::StaticRb;
const RX_RING_BUF_SIZE: usize = 1024; const RX_RING_BUF_SIZE: usize = 1024;
// Ring buffers to handling variable sized telemetry // Ring buffers to handling variable sized telemetry
static mut RINGBUF: Lazy<StaticRb<u8, RX_RING_BUF_SIZE>> = static RINGBUF: Lazy<StaticRb<u8, RX_RING_BUF_SIZE>> =
Lazy::new(StaticRb::<u8, RX_RING_BUF_SIZE>::default); Lazy::new(StaticRb::<u8, RX_RING_BUF_SIZE>::default);
#[rtic::app(device = pac, dispatchers = [OC4])] #[rtic::app(device = pac, dispatchers = [OC4])]
@ -71,7 +71,7 @@ mod app {
rx.start(); rx.start();
let (data_producer, data_consumer) = unsafe { RINGBUF.split_ref() }; let (data_producer, data_consumer) = RINGBUF.split_ref();
echo_handler::spawn().unwrap(); echo_handler::spawn().unwrap();
( (
Shared {}, Shared {},

View File

@ -25,6 +25,8 @@ version = "0.4"
[dependencies.ringbuf] [dependencies.ringbuf]
version = "0.4.7" version = "0.4.7"
default-features = false default-features = false
git = "https://github.com/robamu/ringbuf.git"
branch = "remove-mut-on-split-ref"
features = ["portable-atomic"] features = ["portable-atomic"]
[dependencies.once_cell] [dependencies.once_cell]

View File

@ -45,15 +45,15 @@ const BUF_RB_SIZE_TM: usize = 256;
const SIZES_RB_SIZE_TM: usize = 16; const SIZES_RB_SIZE_TM: usize = 16;
// Ring buffers to handling variable sized telemetry // Ring buffers to handling variable sized telemetry
static mut BUF_RB_TM: Lazy<StaticRb<u8, BUF_RB_SIZE_TM>> = static BUF_RB_TM: Lazy<StaticRb<u8, BUF_RB_SIZE_TM>> =
Lazy::new(StaticRb::<u8, BUF_RB_SIZE_TM>::default); Lazy::new(StaticRb::<u8, BUF_RB_SIZE_TM>::default);
static mut SIZES_RB_TM: Lazy<StaticRb<usize, SIZES_RB_SIZE_TM>> = static SIZES_RB_TM: Lazy<StaticRb<usize, SIZES_RB_SIZE_TM>> =
Lazy::new(StaticRb::<usize, SIZES_RB_SIZE_TM>::default); Lazy::new(StaticRb::<usize, SIZES_RB_SIZE_TM>::default);
// Ring buffers to handling variable sized telecommands // Ring buffers to handling variable sized telecommands
static mut BUF_RB_TC: Lazy<StaticRb<u8, BUF_RB_SIZE_TC>> = static BUF_RB_TC: Lazy<StaticRb<u8, BUF_RB_SIZE_TC>> =
Lazy::new(StaticRb::<u8, BUF_RB_SIZE_TC>::default); Lazy::new(StaticRb::<u8, BUF_RB_SIZE_TC>::default);
static mut SIZES_RB_TC: Lazy<StaticRb<usize, SIZES_RB_SIZE_TC>> = static SIZES_RB_TC: Lazy<StaticRb<usize, SIZES_RB_SIZE_TC>> =
Lazy::new(StaticRb::<usize, SIZES_RB_SIZE_TC>::default); Lazy::new(StaticRb::<usize, SIZES_RB_SIZE_TC>::default);
pub struct DataProducer<const BUF_SIZE: usize, const SIZES_LEN: usize> { pub struct DataProducer<const BUF_SIZE: usize, const SIZES_LEN: usize> {
@ -149,11 +149,11 @@ mod app {
let verif_reporter = VerificationReportCreator::new(0).unwrap(); let verif_reporter = VerificationReportCreator::new(0).unwrap();
let (buf_prod_tm, buf_cons_tm) = unsafe { BUF_RB_TM.split_ref() }; let (buf_prod_tm, buf_cons_tm) = BUF_RB_TM.split_ref();
let (sizes_prod_tm, sizes_cons_tm) = unsafe { SIZES_RB_TM.split_ref() }; let (sizes_prod_tm, sizes_cons_tm) = SIZES_RB_TM.split_ref();
let (buf_prod_tc, buf_cons_tc) = unsafe { BUF_RB_TC.split_ref() }; let (buf_prod_tc, buf_cons_tc) = BUF_RB_TC.split_ref();
let (sizes_prod_tc, sizes_cons_tc) = unsafe { SIZES_RB_TC.split_ref() }; let (sizes_prod_tc, sizes_cons_tc) = SIZES_RB_TC.split_ref();
let mut rx_context = IrqContextTimeoutOrMaxSize::new(MAX_TC_FRAME_SIZE); let mut rx_context = IrqContextTimeoutOrMaxSize::new(MAX_TC_FRAME_SIZE);
rx.read_fixed_len_or_timeout_based_using_irq(&mut rx_context) rx.read_fixed_len_or_timeout_based_using_irq(&mut rx_context)

View File

@ -320,7 +320,6 @@ macro_rules! pin_id {
//================================================================================================== //==================================================================================================
/// A type-level GPIO pin, parameterized by [PinId] and [PinMode] types /// A type-level GPIO pin, parameterized by [PinId] and [PinMode] types
pub struct Pin<I: PinId, M: PinMode> { pub struct Pin<I: PinId, M: PinMode> {
pub(in crate::gpio) regs: Registers<I>, pub(in crate::gpio) regs: Registers<I>,
mode: PhantomData<M>, mode: PhantomData<M>,

View File

@ -284,17 +284,17 @@ impl IrqResultMaxSizeOrTimeout {
#[inline] #[inline]
pub fn overflow_error(&self) -> bool { pub fn overflow_error(&self) -> bool {
self.errors.map_or(false, |e| e.overflow) self.errors.is_some_and(|e| e.overflow)
} }
#[inline] #[inline]
pub fn framing_error(&self) -> bool { pub fn framing_error(&self) -> bool {
self.errors.map_or(false, |e| e.framing) self.errors.is_some_and(|e| e.framing)
} }
#[inline] #[inline]
pub fn parity_error(&self) -> bool { pub fn parity_error(&self) -> bool {
self.errors.map_or(false, |e| e.parity) self.errors.is_some_and(|e| e.parity)
} }
#[inline] #[inline]