Skip to content

Commit 7886776

Browse files
committed
clippy
1 parent 47964ca commit 7886776

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

src/gpio.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ pub enum PinState {
9191
}
9292

9393
/// GPIO Pin speed selection
94+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
9495
pub enum Speed {
9596
Low = 0,
9697
Medium = 1,
9798
High = 2,
9899
VeryHigh = 3,
99100
}
100101

101-
#[derive(Debug, PartialEq)]
102+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
102103
pub enum Edge {
103104
RISING,
104105
FALLING,
@@ -292,12 +293,14 @@ impl<MODE, const P: char> OutputPin for PXx<Output<MODE>, P> {
292293

293294
#[inline(always)]
294295
fn set_high(&mut self) -> Result<(), Self::Error> {
295-
Ok(self.set_high())
296+
self.set_high();
297+
Ok(())
296298
}
297299

298300
#[inline(always)]
299301
fn set_low(&mut self) -> Result<(), Self::Error> {
300-
Ok(self.set_low())
302+
self.set_low();
303+
Ok(())
301304
}
302305
}
303306

@@ -318,7 +321,8 @@ impl<MODE, const P: char> ToggleableOutputPin for PXx<Output<MODE>, P> {
318321

319322
#[inline(always)]
320323
fn toggle(&mut self) -> Result<(), Self::Error> {
321-
Ok(self.toggle())
324+
self.toggle();
325+
Ok(())
322326
}
323327
}
324328

@@ -423,7 +427,7 @@ impl<MODE, const P: char, const N: u8> PinExt for PX<MODE, P, N> {
423427
impl<MODE, const P: char, const N: u8> PX<MODE, P, N> {
424428
/// Configures the pin to operate alternate mode
425429
pub fn into_alternate<const A: u8>(self) -> PX<Alternate<AF<A>>, P, N> {
426-
#[allow(path_statements)]
430+
#[allow(path_statements, clippy::no_effect)]
427431
{
428432
Assert::<A, 16>::LESS;
429433
}
@@ -434,7 +438,7 @@ impl<MODE, const P: char, const N: u8> PX<MODE, P, N> {
434438
/// Configures the pin to operate in alternate open drain mode
435439
#[allow(path_statements)]
436440
pub fn into_alternate_open_drain<const A: u8>(self) -> PX<AlternateOD<AF<A>>, P, N> {
437-
#[allow(path_statements)]
441+
#[allow(path_statements, clippy::no_effect)]
438442
{
439443
Assert::<A, 16>::LESS;
440444
}
@@ -915,12 +919,14 @@ impl<MODE, const P: char, const N: u8> OutputPin for PX<Output<MODE>, P, N> {
915919

916920
#[inline(always)]
917921
fn set_high(&mut self) -> Result<(), Self::Error> {
918-
Ok(self.set_high())
922+
self.set_high();
923+
Ok(())
919924
}
920925

921926
#[inline(always)]
922927
fn set_low(&mut self) -> Result<(), Self::Error> {
923-
Ok(self.set_low())
928+
self.set_low();
929+
Ok(())
924930
}
925931
}
926932

@@ -941,7 +947,8 @@ impl<MODE, const P: char, const N: u8> ToggleableOutputPin for PX<Output<MODE>,
941947

942948
#[inline(always)]
943949
fn toggle(&mut self) -> Result<(), Self::Error> {
944-
Ok(self.toggle())
950+
self.toggle();
951+
Ok(())
945952
}
946953
}
947954

@@ -1371,12 +1378,14 @@ impl<MODE> OutputPin for Pin<Output<MODE>> {
13711378

13721379
#[inline(always)]
13731380
fn set_high(&mut self) -> Result<(), Self::Error> {
1374-
Ok(self.set_high())
1381+
self.set_high();
1382+
Ok(())
13751383
}
13761384

13771385
#[inline(always)]
13781386
fn set_low(&mut self) -> Result<(), Self::Error> {
1379-
Ok(self.set_low())
1387+
self.set_low();
1388+
Ok(())
13801389
}
13811390
}
13821391

@@ -1397,7 +1406,8 @@ impl<MODE> ToggleableOutputPin for Pin<Output<MODE>> {
13971406

13981407
#[inline(always)]
13991408
fn toggle(&mut self) -> Result<(), Self::Error> {
1400-
Ok(self.toggle())
1409+
self.toggle();
1410+
Ok(())
14011411
}
14021412
}
14031413

0 commit comments

Comments
 (0)