mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
fix rustc-1.89 warnings
This commit is contained in:
parent
364efcb67a
commit
ecbac27e76
21 changed files with 31 additions and 18 deletions
|
|
@ -85,20 +85,19 @@ pub fn next_u64() -> u64 {
|
|||
}
|
||||
|
||||
pub fn fill_bytes_via_next(dest: &mut [MaybeUninit<u8>]) {
|
||||
use core::mem::transmute;
|
||||
let mut left = dest;
|
||||
while left.len() >= 8 {
|
||||
let (l, r) = { left }.split_at_mut(8);
|
||||
left = r;
|
||||
let chunk: [u8; 8] = unsafe { transmute(next_u64().to_le()) };
|
||||
let chunk: [u8; 8] = next_u64().to_ne_bytes();
|
||||
l.copy_from_slice(slice_as_uninit(&chunk));
|
||||
}
|
||||
let n = left.len();
|
||||
if n > 4 {
|
||||
let chunk: [u8; 8] = unsafe { transmute(next_u64().to_le()) };
|
||||
let chunk: [u8; 8] = next_u64().to_ne_bytes();
|
||||
left.copy_from_slice(slice_as_uninit(&chunk[..n]));
|
||||
} else if n > 0 {
|
||||
let chunk: [u8; 4] = unsafe { transmute(next_u32().to_le()) };
|
||||
let chunk: [u8; 4] = next_u32().to_ne_bytes();
|
||||
left.copy_from_slice(slice_as_uninit(&chunk[..n]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ enum ClaimReleaseMove {
|
|||
Move(PID /* from */),
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
pub struct MemoryRangeExtra {
|
||||
mem_start: u32,
|
||||
|
|
|
|||
|
|
@ -2192,7 +2192,7 @@ impl CorigineWrapper {
|
|||
c
|
||||
}
|
||||
|
||||
pub fn core(&self) -> std::sync::MutexGuard<CorigineUsb> {
|
||||
pub fn core(&self) -> std::sync::MutexGuard<'_, CorigineUsb> {
|
||||
#[cfg(feature = "verbose-debug")]
|
||||
crate::println!("lock status: {}", if self.hw.try_lock().is_err() { "locked " } else { "unlocked" });
|
||||
self.hw.lock().unwrap()
|
||||
|
|
|
|||
|
|
@ -172,12 +172,14 @@ macro_rules! define_aes_impl {
|
|||
#[doc=$doc]
|
||||
///block cipher (decrypt-only)
|
||||
#[derive(Clone)]
|
||||
#[allow(dead_code)]
|
||||
pub struct $name_dec {
|
||||
inner: $name,
|
||||
}
|
||||
|
||||
impl $name_dec {
|
||||
#[inline(always)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn get_dec_backend(&self) -> $name_back_dec<'_> { self.inner.get_dec_backend() }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,20 +83,19 @@ impl Trng {
|
|||
|
||||
/// This is copied out of the 0.5 API for rand_core
|
||||
pub fn fill_bytes_via_next(&mut self, dest: &mut [u8]) {
|
||||
use core::mem::transmute;
|
||||
let mut left = dest;
|
||||
while left.len() >= 8 {
|
||||
let (l, r) = { left }.split_at_mut(8);
|
||||
left = r;
|
||||
let chunk: [u8; 8] = unsafe { transmute(self.next_u64().to_le()) };
|
||||
let chunk: [u8; 8] = self.next_u64().to_ne_bytes();
|
||||
l.copy_from_slice(&chunk);
|
||||
}
|
||||
let n = left.len();
|
||||
if n > 4 {
|
||||
let chunk: [u8; 8] = unsafe { transmute(self.next_u64().to_le()) };
|
||||
let chunk: [u8; 8] = self.next_u64().to_ne_bytes();
|
||||
left.copy_from_slice(&chunk[..n]);
|
||||
} else if n > 0 {
|
||||
let chunk: [u8; 4] = unsafe { transmute(self.next_u32().to_le()) };
|
||||
let chunk: [u8; 4] = self.next_u32().to_ne_bytes();
|
||||
left.copy_from_slice(&chunk[..n]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ pub(crate) const DNS_NAME_LENGTH_LIMIT: usize = 256;
|
|||
pub(crate) const DNS_PKT_MAX_LEN: usize = 512;
|
||||
|
||||
/// These opcodes can be called by anyone at any time
|
||||
#[allow(dead_code)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
#[repr(C)]
|
||||
pub(crate) enum Opcode {
|
||||
|
|
|
|||
|
|
@ -828,6 +828,7 @@ pub(crate) fn start_time_ux() {
|
|||
}
|
||||
|
||||
// RTC Ux helper functions
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||
pub(crate) enum ValidatorOp {
|
||||
UxMonth,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ pub enum MenuOpcode {
|
|||
}
|
||||
|
||||
impl<'a> Menu<'a> {
|
||||
pub fn new(name: &str) -> Menu {
|
||||
pub fn new(name: &str) -> Menu<'_> {
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
let sid = xous::create_server().expect("can't create private menu message server");
|
||||
let gam = Gam::new(&xns).expect("can't connect to GAM");
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub enum I2cStatus {
|
|||
/// interrupt handler error
|
||||
ResponseInterruptError,
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||
pub(crate) enum I2cCallback {
|
||||
Result,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ pub struct Validation {
|
|||
pub text: TextEntryPayload,
|
||||
pub opcode: u32,
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
pub(crate) enum ValidationOp {
|
||||
Validate,
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ impl Modals {
|
|||
Ok(Modals { conn, token, have_lock: Cell::new(false) })
|
||||
}
|
||||
|
||||
pub fn alert_builder(&self, prompt: &str) -> AlertModalBuilder {
|
||||
pub fn alert_builder(&self, prompt: &str) -> AlertModalBuilder<'_> {
|
||||
AlertModalBuilder {
|
||||
prompt: String::from(prompt),
|
||||
validators: vec![],
|
||||
|
|
|
|||
|
|
@ -387,6 +387,7 @@ pub(crate) struct SsidList {
|
|||
|
||||
/// These opcodes are reserved for private SIDs shared from a DNS server to
|
||||
/// reconfigure DNS on IP change/update.
|
||||
#[allow(dead_code)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
pub(crate) enum PrivateDnsOp {
|
||||
AddIpv4DnsServer,
|
||||
|
|
@ -408,6 +409,7 @@ pub(crate) struct WifiStateSubscription {
|
|||
pub opcode: u32,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||
pub(crate) enum NetCallback {
|
||||
Ping,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ pub(crate) struct NetTcpListenCallback {
|
|||
pub(crate) local_port: u16,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||
pub(crate) enum NetTcpCallback {
|
||||
RxData,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ const PING_IDENT: u16 = 0x22b;
|
|||
/// so the poll interval should be OK to be set quite high.
|
||||
const NET_DEFAULT_POLL_MS: u64 = 900;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
enum WaitOp {
|
||||
WaitMs,
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ impl Pddb {
|
|||
create_key: bool,
|
||||
alloc_hint: Option<usize>,
|
||||
key_changed_cb: Option<impl Fn() + 'static + Send>,
|
||||
) -> Result<PddbKey> {
|
||||
) -> Result<PddbKey<'_>> {
|
||||
if key_name.len() > (KEY_NAME_LEN - 1) {
|
||||
return Err(Error::new(ErrorKind::InvalidInput, "key name too long"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ pub trait Senres {
|
|||
|
||||
fn can_create_writer(&self) -> bool { true }
|
||||
|
||||
fn reader(&self, fourcc: [u8; 4]) -> Option<Reader<Self>>
|
||||
fn reader(&self, fourcc: [u8; 4]) -> Option<Reader<'_, Self>>
|
||||
where
|
||||
Self: core::marker::Sized,
|
||||
{
|
||||
|
|
@ -207,7 +207,7 @@ pub trait Senres {
|
|||
pub trait SenresMut: Senres {
|
||||
fn as_mut_slice(&mut self) -> &mut [u8];
|
||||
fn as_mut_ptr(&mut self) -> *mut u8;
|
||||
fn writer(&mut self, fourcc: [u8; 4]) -> Option<Writer<Self>>
|
||||
fn writer(&mut self, fourcc: [u8; 4]) -> Option<Writer<'_, Self>>
|
||||
where
|
||||
Self: core::marker::Sized,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ pub(crate) fn password_ux_manager(
|
|||
xous::destroy_server(ux_sid).unwrap();
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
pub(crate) enum UxOpcode {
|
||||
// add UX opcodes here, separate from the main loop's
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ impl Test {
|
|||
const SAMPLE_RATE_HZ: f32 = 8000.0;
|
||||
// note to self: A4 = 440.0, E4 = 329.63, C4 = 261.63
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
enum TestOp {
|
||||
KeyCode,
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ pub(crate) enum Opcode {
|
|||
// Erase/Write are uninterruptable operations. Split suspend/resume
|
||||
// into a separate server to asynchronously manage this.
|
||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) enum SusResOps {
|
||||
/// Suspend/resume callback
|
||||
SuspendResume,
|
||||
|
|
|
|||
|
|
@ -115,20 +115,19 @@ impl Trng {
|
|||
|
||||
/// This is copied out of the 0.5 API for rand_core
|
||||
pub fn fill_bytes_via_next(&mut self, dest: &mut [u8]) {
|
||||
use core::mem::transmute;
|
||||
let mut left = dest;
|
||||
while left.len() >= 8 {
|
||||
let (l, r) = { left }.split_at_mut(8);
|
||||
left = r;
|
||||
let chunk: [u8; 8] = unsafe { transmute(self.next_u64().to_le()) };
|
||||
let chunk: [u8; 8] = self.next_u64().to_ne_bytes();
|
||||
l.copy_from_slice(&chunk);
|
||||
}
|
||||
let n = left.len();
|
||||
if n > 4 {
|
||||
let chunk: [u8; 8] = unsafe { transmute(self.next_u64().to_le()) };
|
||||
let chunk: [u8; 8] = self.next_u64().to_ne_bytes();
|
||||
left.copy_from_slice(&chunk[..n]);
|
||||
} else if n > 0 {
|
||||
let chunk: [u8; 4] = unsafe { transmute(self.next_u32().to_le()) };
|
||||
let chunk: [u8; 4] = self.next_u32().to_ne_bytes();
|
||||
left.copy_from_slice(&chunk[..n]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ pub enum U2fCode {
|
|||
Denied,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||
#[repr(usize)]
|
||||
pub enum UsbDeviceType {
|
||||
|
|
@ -188,6 +189,7 @@ pub(crate) struct UsbListenerRegistration {
|
|||
pub listener_op_id: usize,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
||||
#[repr(usize)]
|
||||
pub enum LogLevel {
|
||||
|
|
|
|||
Loading…
Reference in a new issue