From 7f2c3441eb0d3c92e794778cdf9d8c83d64e939c Mon Sep 17 00:00:00 2001 From: Stephan Date: Sun, 11 Jun 2023 11:45:51 +0200 Subject: [PATCH] clippy --- pic32-hal/src/gpio.rs | 12 ++++++------ pic32-hal/src/pps.rs | 1 + pic32-hal/src/time.rs | 3 +++ pic32-hal/src/uart.rs | 4 ++-- pic32-hal/src/usb.rs | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pic32-hal/src/gpio.rs b/pic32-hal/src/gpio.rs index 8e36ea8..919dbcd 100644 --- a/pic32-hal/src/gpio.rs +++ b/pic32-hal/src/gpio.rs @@ -84,7 +84,7 @@ macro_rules! port { ) -> $PXi> { unsafe { $( - $has_ansel; // dummy statement to satisfy macro processor + _ = $has_ansel; // dummy statement to satisfy macro processor (*$PORTX::ptr()).anselclr.write(|w| w.bits(1 << $i)); )? (*$PORTX::ptr()).trisset.write(|w| w.bits(1 << $i)); @@ -100,7 +100,7 @@ macro_rules! port { ) -> $PXi> { unsafe { $( - $has_ansel; // dummy statement to satisfy macro processor + _ = $has_ansel; // dummy statement to satisfy macro processor (*$PORTX::ptr()).anselclr.write(|w| w.bits(1 << $i)); )? (*$PORTX::ptr()).trisset.write(|w| w.bits(1 << $i)); @@ -116,7 +116,7 @@ macro_rules! port { ) -> $PXi> { unsafe { $( - $has_ansel; // dummy statement to satisfy macro processor + _ = $has_ansel; // dummy statement to satisfy macro processor (*$PORTX::ptr()).anselclr.write(|w| w.bits(1 << $i)); )? (*$PORTX::ptr()).trisset.write(|w| w.bits(1 << $i)); @@ -132,7 +132,7 @@ macro_rules! port { ) -> $PXi> { unsafe { $( - $has_ansel; // dummy statement to satisfy macro processor + _ = $has_ansel; // dummy statement to satisfy macro processor (*$PORTX::ptr()).anselclr.write(|w| w.bits(1 << $i)); )? (*$PORTX::ptr()).trisclr.write(|w| w.bits(1 << $i)); @@ -149,7 +149,7 @@ macro_rules! port { ) -> $PXi> { unsafe { $( - $has_ansel; // dummy statement to satisfy macro processor + _ = $has_ansel; // dummy statement to satisfy macro processor (*$PORTX::ptr()).anselclr.write(|w| w.bits(1 << $i)); )? (*$PORTX::ptr()).trisclr.write(|w| w.bits(1 << $i)); @@ -165,7 +165,7 @@ macro_rules! port { pub fn into_analog_input( self, ) -> $PXi> { - $has_ansel; // dummy statement to satisfy macro processor + _ = $has_ansel; // dummy statement to satisfy macro processor unsafe { (*$PORTX::ptr()).anselset.write(|w| w.bits(1 << $i)); (*$PORTX::ptr()).trisset.write(|w| w.bits(1 << $i)); diff --git a/pic32-hal/src/pps.rs b/pic32-hal/src/pps.rs index 49a048a..bc859d5 100644 --- a/pic32-hal/src/pps.rs +++ b/pic32-hal/src/pps.rs @@ -31,6 +31,7 @@ pub struct NoPin; impl NoPin { // Create a new NoPin + #[allow(clippy::new_without_default)] pub fn new() -> NoPin { NoPin } diff --git a/pic32-hal/src/time.rs b/pic32-hal/src/time.rs index 16ac1b0..4686833 100644 --- a/pic32-hal/src/time.rs +++ b/pic32-hal/src/time.rs @@ -1,6 +1,9 @@ //! Types for time units and frequency +//! TODO: replace with fugit // Based on https://github.com/stm32-rs/stm32f4xx-hal/blob/master/src/time.rs +#![allow(clippy::from_over_into)] + /// Bits per second #[derive(PartialEq, PartialOrd, Clone, Copy)] pub struct Bps(pub u32); diff --git a/pic32-hal/src/uart.rs b/pic32-hal/src/uart.rs index e8449d8..4faf533 100644 --- a/pic32-hal/src/uart.rs +++ b/pic32-hal/src/uart.rs @@ -60,8 +60,8 @@ macro_rules! uart_impl { } Uart { _uart: PhantomData, - rx: rx, - tx: tx, + rx, + tx, } } diff --git a/pic32-hal/src/usb.rs b/pic32-hal/src/usb.rs index 4800597..c029714 100644 --- a/pic32-hal/src/usb.rs +++ b/pic32-hal/src/usb.rs @@ -537,7 +537,7 @@ impl usb_device::bus::UsbBus for UsbBus { } USB_PID_SETUP => { // stop any previously submitted IN transactions - if let Some(ref mut ecb_in) = inner.ecb[ep as usize][1] { + if let Some(ref mut ecb_in) = inner.ecb[ep][1] { ecb_in.cancel(); } let ecb_out = inner.ecb[ep][0].as_mut().unwrap(); @@ -547,8 +547,8 @@ impl usb_device::bus::UsbBus for UsbBus { ecb_out.complete_ctr += 1; ecb_out.armed_ctr -= 1; inner.pr_su |= 1 << ep; - inner.ecb[ep as usize][0].as_mut().unwrap().data01 = true; - inner.ecb[ep as usize][1].as_mut().unwrap().data01 = true; + inner.ecb[ep][0].as_mut().unwrap().data01 = true; + inner.ecb[ep][1].as_mut().unwrap().data01 = true; // the USB modules automatically disables USB transactions // after a SETUP transaction. Enable them again. inner.usb.u1conclr.write(|w| w.pktdis_tokbusy().bit(true));