From 381e32c7f6dffc6be76742316b358c2ab3dac8ff Mon Sep 17 00:00:00 2001 From: amrbashir Date: Tue, 13 Aug 2024 20:14:35 +0300 Subject: [PATCH] ok_or_else --- src/hotkey.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/hotkey.rs b/src/hotkey.rs index 4ed396d..57d665e 100644 --- a/src/hotkey.rs +++ b/src/hotkey.rs @@ -231,13 +231,7 @@ fn parse_hotkey(hotkey: &str) -> Result { Ok(HotKey::new( Some(mods), - match key { - Some(k) => k, - None => { - // This would mean the hotkey is more than one modifier with no key. - return Err(HotKeyParseError::InvalidFormat(hotkey.to_string())); - } - }, + key.ok_or_else(|| HotKeyParseError::InvalidFormat(hotkey.to_string()))?, )) }