Skip to content

Commit c558ebd

Browse files
committed
change Self::Error to Never and unwrap
1 parent fe7943d commit c558ebd

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ features = ["stm32h743v", "rt", "quadspi", "sdmmc", "fmc", "usb_hs", "rtc", "eth
2525
targets = ["thumbv7em-none-eabihf"]
2626

2727
[dependencies]
28-
embedded-hal = "0.2.4"
28+
embedded-hal = "0.2.6"
2929
embedded-dma = "0.1.2"
3030
cortex-m = "^0.7.1"
3131
stm32h7 = "^0.14.0"

src/gpio.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,11 @@ macro_rules! gpio {
771771
for $PXi<Output<OpenDrain>>
772772
{
773773
type Error = Never;
774-
fn into_input_pin(self) -> Result<Self, Self::Error> {
774+
fn into_input_pin(self) -> Result<Self, Never> {
775775
Ok(self)
776776
}
777-
fn into_output_pin(mut self, state: PinState) -> Result<Self, Self::Error> {
778-
self.set_state(state)?;
777+
fn into_output_pin(mut self, state: PinState) -> Result<Self, Never> {
778+
self.set_state(state).unwrap(); // Infallible
779779
Ok(self)
780780
}
781781
}
@@ -784,11 +784,11 @@ macro_rules! gpio {
784784
for $PXi<Output<PushPull>>
785785
{
786786
type Error = Never;
787-
fn into_input_pin(self) -> Result<$PXi<Input<Floating>>, Self::Error> {
787+
fn into_input_pin(self) -> Result<$PXi<Input<Floating>>, Never> {
788788
Ok(self.into_floating_input())
789789
}
790-
fn into_output_pin(mut self, state: PinState) -> Result<Self, Self::Error> {
791-
self.set_state(state)?;
790+
fn into_output_pin(mut self, state: PinState) -> Result<Self, Never> {
791+
self.set_state(state).unwrap(); // Infallible
792792
Ok(self)
793793
}
794794
}
@@ -797,12 +797,12 @@ macro_rules! gpio {
797797
for $PXi<Input<Floating>>
798798
{
799799
type Error = Never;
800-
fn into_input_pin(self) -> Result<Self, Self::Error> {
800+
fn into_input_pin(self) -> Result<Self, Never> {
801801
Ok(self)
802802
}
803-
fn into_output_pin(self, state: PinState) -> Result<$PXi<Output<PushPull>>, Self::Error> {
803+
fn into_output_pin(self, state: PinState) -> Result<$PXi<Output<PushPull>>, Never> {
804804
let mut pin = self.into_push_pull_output();
805-
pin.set_state(state)?;
805+
pin.set_state(state).unwrap(); // Infallible
806806
Ok(pin)
807807
}
808808
}

0 commit comments

Comments
 (0)