Skip to content

Commit

Permalink
Merge pull request 'some clippy fixes' (#23) from some-clippy-fixes i…
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jan 10, 2025
2 parents cf55fe1 + f438e7e commit cd222fd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 2 additions & 0 deletions examples/rtic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ features = ["critical-section"]
[dependencies.ringbuf]
version = "0.4.7"
default-features = false
git = "https://github.com/robamu/ringbuf.git"
branch = "remove-mut-on-split-ref"
features = ["portable-atomic"]

[dependencies.va108xx-hal]
Expand Down
4 changes: 2 additions & 2 deletions examples/rtic/src/bin/uart-echo-rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ringbuf::StaticRb;
const RX_RING_BUF_SIZE: usize = 1024;

// 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);

#[rtic::app(device = pac, dispatchers = [OC4])]
Expand Down Expand Up @@ -71,7 +71,7 @@ mod app {

rx.start();

let (data_producer, data_consumer) = unsafe { RINGBUF.split_ref() };
let (data_producer, data_consumer) = RINGBUF.split_ref();
echo_handler::spawn().unwrap();
(
Shared {},
Expand Down
2 changes: 2 additions & 0 deletions flashloader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ version = "0.4"
[dependencies.ringbuf]
version = "0.4.7"
default-features = false
git = "https://github.com/robamu/ringbuf.git"
branch = "remove-mut-on-split-ref"
features = ["portable-atomic"]

[dependencies.once_cell]
Expand Down
16 changes: 8 additions & 8 deletions flashloader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ const BUF_RB_SIZE_TM: usize = 256;
const SIZES_RB_SIZE_TM: usize = 16;

// 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);
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);

// 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);
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);

pub struct DataProducer<const BUF_SIZE: usize, const SIZES_LEN: usize> {
Expand Down Expand Up @@ -149,11 +149,11 @@ mod app {

let verif_reporter = VerificationReportCreator::new(0).unwrap();

let (buf_prod_tm, buf_cons_tm) = unsafe { BUF_RB_TM.split_ref() };
let (sizes_prod_tm, sizes_cons_tm) = unsafe { SIZES_RB_TM.split_ref() };
let (buf_prod_tm, buf_cons_tm) = BUF_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 (sizes_prod_tc, sizes_cons_tc) = unsafe { SIZES_RB_TC.split_ref() };
let (buf_prod_tc, buf_cons_tc) = BUF_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);
rx.read_fixed_len_or_timeout_based_using_irq(&mut rx_context)
Expand Down
1 change: 0 additions & 1 deletion va108xx-hal/src/gpio/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ macro_rules! pin_id {
//==================================================================================================

/// A type-level GPIO pin, parameterized by [PinId] and [PinMode] types
pub struct Pin<I: PinId, M: PinMode> {
pub(in crate::gpio) regs: Registers<I>,
mode: PhantomData<M>,
Expand Down
6 changes: 3 additions & 3 deletions va108xx-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,17 @@ impl IrqResultMaxSizeOrTimeout {

#[inline]
pub fn overflow_error(&self) -> bool {
self.errors.map_or(false, |e| e.overflow)
self.errors.is_some_and(|e| e.overflow)
}

#[inline]
pub fn framing_error(&self) -> bool {
self.errors.map_or(false, |e| e.framing)
self.errors.is_some_and(|e| e.framing)
}

#[inline]
pub fn parity_error(&self) -> bool {
self.errors.map_or(false, |e| e.parity)
self.errors.is_some_and(|e| e.parity)
}

#[inline]
Expand Down

0 comments on commit cd222fd

Please sign in to comment.