Skip to content

Commit 3afc5e4

Browse files
authored
Merge pull request #3239 from plaes/nrf-clippy
nrf: Fix bunch of low-hanging clippy lint warnings
2 parents f31e718 + 2e8d9db commit 3afc5e4

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

embassy-nrf/src/buffered_uarte.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> {
219219
/// # Panics
220220
///
221221
/// Panics if `rx_buffer.len()` is odd.
222+
#[allow(clippy::too_many_arguments)]
222223
pub fn new(
223224
uarte: impl Peripheral<P = U> + 'd,
224225
timer: impl Peripheral<P = T> + 'd,
@@ -254,6 +255,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> {
254255
/// # Panics
255256
///
256257
/// Panics if `rx_buffer.len()` is odd.
258+
#[allow(clippy::too_many_arguments)]
257259
pub fn new_with_rtscts(
258260
uarte: impl Peripheral<P = U> + 'd,
259261
timer: impl Peripheral<P = T> + 'd,
@@ -286,6 +288,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> {
286288
)
287289
}
288290

291+
#[allow(clippy::too_many_arguments)]
289292
fn new_inner(
290293
peri: PeripheralRef<'d, U>,
291294
timer: PeripheralRef<'d, T>,
@@ -534,6 +537,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
534537
/// # Panics
535538
///
536539
/// Panics if `rx_buffer.len()` is odd.
540+
#[allow(clippy::too_many_arguments)]
537541
pub fn new(
538542
uarte: impl Peripheral<P = U> + 'd,
539543
timer: impl Peripheral<P = T> + 'd,
@@ -564,6 +568,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
564568
/// # Panics
565569
///
566570
/// Panics if `rx_buffer.len()` is odd.
571+
#[allow(clippy::too_many_arguments)]
567572
pub fn new_with_rts(
568573
uarte: impl Peripheral<P = U> + 'd,
569574
timer: impl Peripheral<P = T> + 'd,
@@ -590,6 +595,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
590595
)
591596
}
592597

598+
#[allow(clippy::too_many_arguments)]
593599
fn new_inner(
594600
peri: PeripheralRef<'d, U>,
595601
timer: PeripheralRef<'d, T>,
@@ -614,6 +620,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
614620
this
615621
}
616622

623+
#[allow(clippy::too_many_arguments)]
617624
fn new_innerer(
618625
peri: PeripheralRef<'d, U>,
619626
timer: PeripheralRef<'d, T>,

embassy-nrf/src/gpio.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,13 @@ mod eh02 {
534534
type Error = Infallible;
535535

536536
fn set_high(&mut self) -> Result<(), Self::Error> {
537-
Ok(self.set_high())
537+
self.set_high();
538+
Ok(())
538539
}
539540

540541
fn set_low(&mut self) -> Result<(), Self::Error> {
541-
Ok(self.set_low())
542+
self.set_low();
543+
Ok(())
542544
}
543545
}
544546

@@ -580,11 +582,13 @@ mod eh02 {
580582
type Error = Infallible;
581583

582584
fn set_high(&mut self) -> Result<(), Self::Error> {
583-
Ok(self.set_high())
585+
self.set_high();
586+
Ok(())
584587
}
585588

586589
fn set_low(&mut self) -> Result<(), Self::Error> {
587-
Ok(self.set_low())
590+
self.set_low();
591+
Ok(())
588592
}
589593
}
590594

@@ -628,11 +632,13 @@ impl<'d> embedded_hal_1::digital::ErrorType for Output<'d> {
628632

629633
impl<'d> embedded_hal_1::digital::OutputPin for Output<'d> {
630634
fn set_high(&mut self) -> Result<(), Self::Error> {
631-
Ok(self.set_high())
635+
self.set_high();
636+
Ok(())
632637
}
633638

634639
fn set_low(&mut self) -> Result<(), Self::Error> {
635-
Ok(self.set_low())
640+
self.set_low();
641+
Ok(())
636642
}
637643
}
638644

@@ -665,11 +671,13 @@ impl<'d> embedded_hal_1::digital::InputPin for Flex<'d> {
665671

666672
impl<'d> embedded_hal_1::digital::OutputPin for Flex<'d> {
667673
fn set_high(&mut self) -> Result<(), Self::Error> {
668-
Ok(self.set_high())
674+
self.set_high();
675+
Ok(())
669676
}
670677

671678
fn set_low(&mut self) -> Result<(), Self::Error> {
672-
Ok(self.set_low())
679+
self.set_low();
680+
Ok(())
673681
}
674682
}
675683

embassy-nrf/src/wdt.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ impl WatchdogHandle {
184184

185185
/// Steal a watchdog handle by index.
186186
///
187-
/// Safety: watchdog must be initialized, index must be between 0 and N-1 where
188-
/// N is the handle count when initializing.
187+
/// # Safety
188+
/// Watchdog must be initialized and `index` must be between `0` and `N-1`
189+
/// where `N` is the handle count when initializing.
189190
pub unsafe fn steal(index: u8) -> Self {
190191
Self { index }
191192
}

0 commit comments

Comments
 (0)