Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kiffie committed Jun 11, 2023
1 parent 09a17be commit 7f2c344
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions pic32-hal/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ macro_rules! port {
) -> $PXi<Input<Floating>> {
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));
Expand All @@ -100,7 +100,7 @@ macro_rules! port {
) -> $PXi<Input<PullDown>> {
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));
Expand All @@ -116,7 +116,7 @@ macro_rules! port {
) -> $PXi<Input<PullUp>> {
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));
Expand All @@ -132,7 +132,7 @@ macro_rules! port {
) -> $PXi<Output<OpenDrain>> {
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));
Expand All @@ -149,7 +149,7 @@ macro_rules! port {
) -> $PXi<Output<PushPull>> {
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));
Expand All @@ -165,7 +165,7 @@ macro_rules! port {
pub fn into_analog_input(
self,
) -> $PXi<Input<Analog>> {
$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));
Expand Down
1 change: 1 addition & 0 deletions pic32-hal/src/pps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub struct NoPin;

impl NoPin {
// Create a new NoPin
#[allow(clippy::new_without_default)]
pub fn new() -> NoPin {
NoPin
}
Expand Down
3 changes: 3 additions & 0 deletions pic32-hal/src/time.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 2 additions & 2 deletions pic32-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ macro_rules! uart_impl {
}
Uart {
_uart: PhantomData,
rx: rx,
tx: tx,
rx,
tx,
}
}

Expand Down
6 changes: 3 additions & 3 deletions pic32-hal/src/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
Expand Down

0 comments on commit 7f2c344

Please sign in to comment.