diff --git a/platforms/allwinner-d1/d1-core/src/dmac/descriptor.rs b/platforms/allwinner-d1/d1-core/src/dmac/descriptor.rs index a1a74bc5..acb76dcc 100644 --- a/platforms/allwinner-d1/d1-core/src/dmac/descriptor.rs +++ b/platforms/allwinner-d1/d1-core/src/dmac/descriptor.rs @@ -5,11 +5,13 @@ // separate the bits by which field they represent, rather than by their byte. #![allow(clippy::unusual_byte_groupings)] -use self::errors::*; use core::{cmp, mem, ptr::NonNull}; + use d1_pac::generic::{Reg, RegisterSpec}; use mycelium_bitfield::{bitfield, enum_from_bits}; +use self::errors::*; + #[derive(Clone, Debug)] #[repr(C, align(4))] pub struct Descriptor { @@ -195,6 +197,12 @@ bitfield! { } } +impl Default for DescriptorBuilder { + fn default() -> Self { + Self::new() + } +} + impl DescriptorBuilder { pub const fn new() -> Self { Self { @@ -557,9 +565,10 @@ impl Descriptor { } pub mod errors { - use super::*; use core::fmt; + use super::*; + /// Errors returned by [`DescriptorBuilder::build`]. #[derive(Clone, Debug, Eq, PartialEq)] pub enum InvalidDescriptor { diff --git a/platforms/allwinner-d1/d1-core/src/drivers/smhc.rs b/platforms/allwinner-d1/d1-core/src/drivers/smhc.rs index 51619e51..e7c2e5b8 100644 --- a/platforms/allwinner-d1/d1-core/src/drivers/smhc.rs +++ b/platforms/allwinner-d1/d1-core/src/drivers/smhc.rs @@ -16,7 +16,6 @@ use core::{ task::{Poll, Waker}, }; -use crate::ccu::Ccu; use d1_pac::{smhc, Interrupt, GPIO, SMHC0, SMHC1, SMHC2}; use kernel::{ mnemos_alloc::containers::FixedVec, @@ -25,6 +24,8 @@ use kernel::{ tracing, Kernel, }; +use crate::ccu::Ccu; + pub struct Smhc { isr: &'static IsrData, smhc: &'static smhc::RegisterBlock, @@ -518,6 +519,8 @@ impl Smhc { self.smhc.smhc_resp2.read().bits(), self.smhc.smhc_resp3.read().bits(), ]; + // TODO warning: transmute used without annotations + #[allow(clippy::missing_transmute_annotations)] Ok(sdmmc::Response::Long(unsafe { core::mem::transmute(rsp) })) } else { Ok(sdmmc::Response::Short { @@ -715,8 +718,8 @@ impl SmhcData { /// Internal DMA controller mod idmac { - use core::mem; - use core::ptr::NonNull; + use core::{mem, ptr::NonNull}; + use mycelium_bitfield::bitfield; /// A descriptor that describes how memory needs to transfer data diff --git a/platforms/allwinner-d1/d1-core/src/drivers/uart.rs b/platforms/allwinner-d1/d1-core/src/drivers/uart.rs index 345ff7cf..6deafb58 100644 --- a/platforms/allwinner-d1/d1-core/src/drivers/uart.rs +++ b/platforms/allwinner-d1/d1-core/src/drivers/uart.rs @@ -1,18 +1,12 @@ // Note: We sometimes force a pass by ref mut to enforce exclusive access #![allow(clippy::needless_pass_by_ref_mut)] -use d1_pac::{GPIO, UART0}; - use core::{ ptr::{null_mut, NonNull}, sync::atomic::{AtomicPtr, Ordering}, }; -use crate::ccu::Ccu; -use crate::dmac::{ - descriptor::{BlockSize, DataWidth, Descriptor, DestDrqType}, - ChannelMode, Dmac, -}; +use d1_pac::{GPIO, UART0}; use kernel::{ comms::bbq::{new_bidi_channel, BidiHandle, Consumer, GrantW, SpscProducer}, maitake::sync::WaitCell, @@ -21,9 +15,17 @@ use kernel::{ services::simple_serial::{Request, Response, SimpleSerialError, SimpleSerialService}, Kernel, }; - use tracing::Level; +use crate::{ + ccu::Ccu, + dmac::{ + descriptor::{BlockSize, DataWidth, Descriptor, DestDrqType}, + ChannelMode, Dmac, + }, +}; + +#[allow(dead_code)] struct GrantWriter { grant: GrantW, used: usize, diff --git a/platforms/allwinner-d1/d1-core/src/plic.rs b/platforms/allwinner-d1/d1-core/src/plic.rs index 152d3a25..a266ffb9 100644 --- a/platforms/allwinner-d1/d1-core/src/plic.rs +++ b/platforms/allwinner-d1/d1-core/src/plic.rs @@ -183,6 +183,7 @@ trait IntoBits: Sized + Copy { fn into_bits(self) -> u32; } +#[allow(dead_code)] trait TryFromBits: Sized + Copy { type Error; fn try_from_bits(bits: u32) -> Result; diff --git a/platforms/allwinner-d1/d1-core/src/ram.rs b/platforms/allwinner-d1/d1-core/src/ram.rs index eae1df6e..39bcb20e 100644 --- a/platforms/allwinner-d1/d1-core/src/ram.rs +++ b/platforms/allwinner-d1/d1-core/src/ram.rs @@ -5,6 +5,12 @@ pub struct Ram { } unsafe impl Sync for Ram {} + +impl Default for Ram { + fn default() -> Self { + Self::new() + } +} impl Ram { pub const fn new() -> Self { Self { diff --git a/platforms/esp32c3-buddy/src/drivers/uart.rs b/platforms/esp32c3-buddy/src/drivers/uart.rs index 5259d93b..ef6c1251 100644 --- a/platforms/esp32c3-buddy/src/drivers/uart.rs +++ b/platforms/esp32c3-buddy/src/drivers/uart.rs @@ -8,7 +8,6 @@ use esp32c3_hal::{ prelude::interrupt, uart::{Instance, Uart}, }; - use kernel::{ comms::bbq::{new_bidi_channel, BidiHandle, Consumer, GrantW, SpscProducer}, maitake::sync::WaitCell, @@ -18,6 +17,8 @@ use kernel::{ Kernel, }; +// TODO warning: struct `GrantWriter` is never constructed +#[allow(dead_code)] struct GrantWriter { grant: GrantW, used: usize, diff --git a/platforms/esp32c3-buddy/src/drivers/usb_serial.rs b/platforms/esp32c3-buddy/src/drivers/usb_serial.rs index 1ab64f0b..4e589a03 100644 --- a/platforms/esp32c3-buddy/src/drivers/usb_serial.rs +++ b/platforms/esp32c3-buddy/src/drivers/usb_serial.rs @@ -1,5 +1,4 @@ use esp32c3_hal::{peripherals::USB_DEVICE, prelude::*}; - use futures::FutureExt; use kernel::{ comms::bbq::{new_bidi_channel, BidiHandle, GrantW}, @@ -13,6 +12,9 @@ pub struct UsbSerialServer { dev: USB_DEVICE, } +// TODO warning: struct `GrantWriter` is never constructed +#[allow(dead_code)] + struct GrantWriter { grant: GrantW, used: usize, diff --git a/source/abi/src/bbqueue_ipc/bbbuffer.rs b/source/abi/src/bbqueue_ipc/bbbuffer.rs index 45191a79..e55c7499 100644 --- a/source/abi/src/bbqueue_ipc/bbbuffer.rs +++ b/source/abi/src/bbqueue_ipc/bbbuffer.rs @@ -104,6 +104,12 @@ impl<'a> BBBuffer { } } +impl Default for BBBuffer { + fn default() -> Self { + Self::new() + } +} + impl BBBuffer { /// Create a new constant inner portion of a `BBBuffer`. /// diff --git a/source/alloc/src/heap.rs b/source/alloc/src/heap.rs index 026bc1ed..e2674ac2 100644 --- a/source/alloc/src/heap.rs +++ b/source/alloc/src/heap.rs @@ -62,6 +62,12 @@ pub enum InitError { #[cfg(feature = "stats")] pub use self::stats::State; +impl Default for MnemosAlloc { + fn default() -> Self { + Self::new() + } +} + impl MnemosAlloc { const INITIALIZING: usize = usize::MAX; diff --git a/source/bitslab/src/index.rs b/source/bitslab/src/index.rs index 990f41f6..f4de0838 100644 --- a/source/bitslab/src/index.rs +++ b/source/bitslab/src/index.rs @@ -28,6 +28,12 @@ macro_rules! make_index_allocs { max_mask: $Int, } + impl Default for $Name { + fn default() -> Self { + Self::new() + } + } + impl $Name { #[doc = concat!("Returns a new allocator for up to ", stringify!($cap), " unique indices.")] #[must_use] diff --git a/source/kernel/src/lib.rs b/source/kernel/src/lib.rs index 3ef5aa79..7176699c 100644 --- a/source/kernel/src/lib.rs +++ b/source/kernel/src/lib.rs @@ -70,7 +70,6 @@ #![cfg_attr(not(test), no_std)] #![allow(clippy::missing_safety_doc)] #![feature(impl_trait_in_assoc_type)] -#![feature(async_fn_in_trait)] // needed for `embedded-hal-async` extern crate alloc; @@ -88,12 +87,13 @@ pub mod services; #[cfg(test)] pub(crate) mod test_util; +use core::{convert::identity, future::Future, ptr::NonNull}; + use abi::{ bbqueue_ipc::BBBuffer, syscall::{KernelResponse, UserRequest}, }; use comms::kchannel::KChannel; -use core::{convert::identity, future::Future, ptr::NonNull}; pub use embedded_hal_async; pub use maitake; use maitake::{ diff --git a/source/kernel/src/services/sdmmc.rs b/source/kernel/src/services/sdmmc.rs index 1128811a..de9ee577 100644 --- a/source/kernel/src/services/sdmmc.rs +++ b/source/kernel/src/services/sdmmc.rs @@ -6,14 +6,15 @@ //! while the platform driver will implement the device specific part //! (how to send and receive the data). #![warn(missing_docs)] +use maitake::time::{self, Duration}; +use uuid::Uuid; + use crate::{ comms::oneshot::Reusable, mnemos_alloc::containers::FixedVec, registry::{self, known_uuids, Envelope, KernelHandle, RegisteredDriver}, Kernel, }; -use maitake::time::{self, Duration}; -use uuid::Uuid; //////////////////////////////////////////////////////////////////////////////// // Service Definition @@ -244,6 +245,7 @@ pub struct CardStatus(u32); /// | Manufacturing date | `[19:8]` | /// | CRC7 checksum | `[7:1]` | /// | Not used, always 1 | `[0:0]` | +#[allow(dead_code)] pub struct CardIdentification(u128); /// Published RCA in R6 response format diff --git a/source/spitebuf/src/lib.rs b/source/spitebuf/src/lib.rs index 74ef0241..589ad0cc 100644 --- a/source/spitebuf/src/lib.rs +++ b/source/spitebuf/src/lib.rs @@ -13,12 +13,13 @@ #![no_std] #![allow(clippy::missing_safety_doc)] -use core::marker::PhantomData; use core::{ cell::UnsafeCell, + marker::PhantomData, mem::MaybeUninit, sync::atomic::{AtomicBool, AtomicUsize, Ordering}, }; + use maitake::sync::{WaitCell, WaitQueue}; pub unsafe trait Storage { @@ -178,6 +179,8 @@ pub fn cell_array() -> [Cell; N] { } impl Cell { + // TODO https://rust-lang.github.io/rust-clippy/master/index.html#/declare_interior_mutable_const + #[allow(clippy::declare_interior_mutable_const)] const SINGLE_CELL: Self = Self::new(0); const fn new(seq: usize) -> Self {