fix more rustc warnings

This commit is contained in:
bunnie 2025-08-19 19:48:16 +08:00
parent 53c4485387
commit 54648161ab
5 changed files with 6 additions and 4 deletions

View file

@ -43,7 +43,7 @@ impl<S: Storage> Linear<S> {
///
/// This function may allocate if the slice spans multiple pages (because they may not be
/// contiguous). However, a slice is returned if the range fits within a page.
pub fn read(&self, range: Range<usize>) -> StorageResult<Cow<[u8]>> {
pub fn read(&self, range: Range<usize>) -> StorageResult<Cow<'_, [u8]>> {
if range.is_empty() {
return Ok(Cow::Borrowed(&[]));
}

View file

@ -73,7 +73,7 @@ pub trait Storage {
///
/// Note that we use `Cow` just because it derefs to `[u8]`. We don't really need the fact that
/// one can convert it to a `Vec`. In particular we don't do it in the store implementation.
fn read_slice(&self, index: StorageIndex, length: usize) -> StorageResult<Cow<[u8]>>;
fn read_slice(&self, index: StorageIndex, length: usize) -> StorageResult<Cow<'_, [u8]>>;
/// Writes a word slice to the storage.
///

View file

@ -360,7 +360,7 @@ impl CtapHid {
}
/// Helper function to parse a raw packet.
pub fn process_single_packet(packet: &HidPacket) -> (ChannelID, ProcessedPacket) {
pub fn process_single_packet(packet: &HidPacket) -> (ChannelID, ProcessedPacket<'_>) {
let (&cid, rest) = array_refs![packet, 4, 60];
if rest[0] & CtapHid::PACKET_TYPE_MASK != 0 {
let cmd = rest[0] & !CtapHid::PACKET_TYPE_MASK;

View file

@ -48,7 +48,7 @@ impl Storage for XousStorage {
100_000
}
fn read_slice(&self, _index: StorageIndex, _length: usize) -> StorageResult<Cow<[u8]>> {
fn read_slice(&self, _index: StorageIndex, _length: usize) -> StorageResult<Cow<'_, [u8]>> {
unimplemented!()
}

View file

@ -1,10 +1,12 @@
use utralib::generated::*;
#[allow(dead_code)]
pub struct Uart {
// pub base: *mut u32,
}
impl Uart {
#[cfg(any(feature = "precursor", feature = "renode"))]
#[allow(dead_code)]
pub fn putc(&self, c: u8) {
let base = utra::uart::HW_UART_BASE as *mut u32;
let mut uart = CSR::new(base);