Fix new clippy lints introduced in 1.78 & 1.79 (#1776)

* Fix new clippy lints introduced in 1.78 & 1.79

* Patch semihosting
This commit is contained in:
Scott Mabin 2024-07-09 06:23:19 -07:00 committed by GitHub
parent eb54168228
commit e75d43d3f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 26 additions and 10 deletions

View File

@ -205,7 +205,7 @@ impl<ADCI> AdcCalScheme<ADCI> for () {
}
/// A helper trait to get access to ADC calibration efuses.
#[cfg(not(esp32h2))]
#[cfg(not(any(esp32, esp32s2, esp32h2)))]
trait AdcCalEfuse {
/// Get ADC calibration init code
///

View File

@ -413,14 +413,13 @@ mod vectored {
// this has no effect on level interrupts, but the interrupt may be an edge one
// so we clear it anyway
clear(core, cpu_intr);
let configured_interrupts = get_configured_interrupts(core, status, unsafe {
core::mem::transmute(INTERRUPT_TO_PRIORITY[cpu_intr as usize - 1] as u8)
});
let prio: Priority =
unsafe { core::mem::transmute(INTERRUPT_TO_PRIORITY[cpu_intr as usize - 1] as u8) };
let configured_interrupts = get_configured_interrupts(core, status, prio);
for interrupt_nr in configured_interrupts.iterator() {
// Don't use `Interrupt::try_from`. It's slower and placed in flash
let interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
let interrupt: Interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
handle_interrupt(interrupt, context);
}
}

View File

@ -476,7 +476,7 @@ mod vectored {
for interrupt_nr in configured_interrupts.iterator() {
// Don't use `Interrupt::try_from`. It's slower and placed in flash
let interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
let interrupt: Interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
handle_interrupt(level, interrupt, save_frame);
}
} else {
@ -487,7 +487,7 @@ mod vectored {
for interrupt_nr in configured_interrupts.iterator() {
// Don't use `Interrupt::try_from`. It's slower and placed in flash
let interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
let interrupt: Interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
handle_interrupt(level, interrupt, save_frame);
}
}

View File

@ -84,6 +84,12 @@ pub struct Stack<const SIZE: usize> {
pub mem: MaybeUninit<[u8; SIZE]>,
}
impl<const SIZE: usize> Default for Stack<SIZE> {
fn default() -> Self {
Self::new()
}
}
#[allow(clippy::len_without_is_empty)]
impl<const SIZE: usize> Stack<SIZE> {
/// Construct a stack of length SIZE, uninitialized

View File

@ -84,6 +84,12 @@ pub struct Stack<const SIZE: usize> {
pub mem: MaybeUninit<[u8; SIZE]>,
}
impl<const SIZE: usize> Default for Stack<SIZE> {
fn default() -> Self {
Self::new()
}
}
#[allow(clippy::len_without_is_empty)]
impl<const SIZE: usize> Stack<SIZE> {
/// Construct a stack of length SIZE, uninitialized

View File

@ -225,7 +225,8 @@ impl<'a> Ieee802154<'a> {
pub fn set_tx_done_callback(&mut self, callback: &'a mut (dyn FnMut() + Send)) {
critical_section::with(|cs| {
let mut tx_done_callback = TX_DONE_CALLBACK.borrow_ref_mut(cs);
tx_done_callback.replace(unsafe { core::mem::transmute(callback) });
let cb: &'static mut (dyn FnMut() + Send) = unsafe { core::mem::transmute(callback) };
tx_done_callback.replace(cb);
});
}
@ -241,7 +242,8 @@ impl<'a> Ieee802154<'a> {
pub fn set_rx_available_callback(&mut self, callback: &'a mut (dyn FnMut() + Send)) {
critical_section::with(|cs| {
let mut rx_available_callback = RX_AVAILABLE_CALLBACK.borrow_ref_mut(cs);
rx_available_callback.replace(unsafe { core::mem::transmute(callback) });
let cb: &'static mut (dyn FnMut() + Send) = unsafe { core::mem::transmute(callback) };
rx_available_callback.replace(cb);
});
}

View File

@ -118,6 +118,9 @@ nb = "1.1.0"
p192 = { version = "0.13.0", default-features = false, features = ["arithmetic"] }
p256 = { version = "0.13.2", default-features = false, features = ["arithmetic"] }
[patch.crates-io]
semihosting = { git = "https://github.com/taiki-e/semihosting", tag = "v0.1.10" }
[features]
default = ["async", "embassy", "embassy-time-timg0"]