diff options
| author | Joël Schulz-Andres <[email protected]> | 2024-05-24 14:09:29 +0200 |
|---|---|---|
| committer | Joël Schulz-Andres <[email protected]> | 2024-05-24 14:09:29 +0200 |
| commit | fab434ae844d6fd64a5cdd282d47515a29e952e8 (patch) | |
| tree | c00ca32bac92768d6123fdff9c1a9fd69b3d8d58 | |
| parent | 32a75cb7641faa8231d04a3ac53e9acac6a95d8f (diff) | |
Use match instead of if
| -rw-r--r-- | embassy-stm32/src/macros.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/embassy-stm32/src/macros.rs b/embassy-stm32/src/macros.rs index 8ffa50021..2458d089f 100644 --- a/embassy-stm32/src/macros.rs +++ b/embassy-stm32/src/macros.rs | |||
| @@ -108,9 +108,10 @@ macro_rules! new_pin { | |||
| 108 | pin.set_as_af_pull(pin.af_num(), $aftype, $pull); | 108 | pin.set_as_af_pull(pin.af_num(), $aftype, $pull); |
| 109 | // Do not call set_speed on AFType::Input, as MODE and CNF bits are not independent | 109 | // Do not call set_speed on AFType::Input, as MODE and CNF bits are not independent |
| 110 | // for gpio_v1 | 110 | // for gpio_v1 |
| 111 | if $aftype != crate::gpio::AFType::Input { | 111 | match $aftype { |
| 112 | pin.set_speed($speed); | 112 | crate::gpio::AFType::Input => {}, |
| 113 | } | 113 | _ => pin.set_speed($speed); |
| 114 | }; | ||
| 114 | Some(pin.map_into()) | 115 | Some(pin.map_into()) |
| 115 | }}; | 116 | }}; |
| 116 | } | 117 | } |
