Skip to content

Commit

Permalink
ok_or_else
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Aug 13, 2024
1 parent c476e23 commit 381e32c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,7 @@ fn parse_hotkey(hotkey: &str) -> Result<HotKey, HotKeyParseError> {

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()))?,
))
}

Expand Down

0 comments on commit 381e32c

Please sign in to comment.