Skip to content

Commit

Permalink
prefer let..else to equivalent match
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallagher committed Oct 2, 2023
1 parent 5f6ee09 commit 8a82c0a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions task/host-sp-comms/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ impl HostKeyValueStorage {
}

fn key_set(&mut self, key: u8, data: &[u8]) -> KeySetResult {
let key = match Key::from_u8(key) {
Some(key) => key,
None => return KeySetResult::InvalidKey,
let Some(key) = Key::from_u8(key) else {
return KeySetResult::InvalidKey;
};

let (buf, buf_len) = match key {
Expand Down

0 comments on commit 8a82c0a

Please sign in to comment.