tony / oxwm

simplify `handle_spawn_action` with if-let instead of match Browse files
replaced single branch match with if-let
emzywastaken committed 2025-10-14 parent fa60658 commit fe6d8c84dd612516e25ca5b7c2e49744da584b24
Showing 1 changed file with 3 additions and 4 deletions. UnifiedSplit
+3 −4 src/keyboard/handlers.rs
@@ -99,8 +99,8 @@ pub fn handle_key_press(event: KeyPressEvent, keybindings: &[Key]) -> (KeyAction
99 99
100 100 pub fn handle_spawn_action(action: KeyAction, arg: &Arg) -> io::Result<()> {
101 101 use io::ErrorKind;
102 - match action {
103 - KeyAction::Spawn => match arg {
102 + if let KeyAction::Spawn = action {
103 + match arg {
104 104 Arg::Str(command) => match Command::new(command).spawn() {
105 105 Err(err) if err.kind() == ErrorKind::NotFound => {
106 106 eprintln!(
@@ -128,8 +128,7 @@ pub fn handle_spawn_action(action: KeyAction, arg: &Arg) -> io::Result<()> {
128 128 }
129 129 }
130 130 _ => {}
131 - },
132 - _ => {}
131 + }
133 132 }
134 133
135 134 Ok(())