From 8a82c0a527a9acb28dd1a28b4237832c8a3cef5c Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Mon, 2 Oct 2023 11:41:56 -0400 Subject: [PATCH] prefer let..else to equivalent match --- task/host-sp-comms/src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/task/host-sp-comms/src/main.rs b/task/host-sp-comms/src/main.rs index b0bc729b9..f6b03865a 100644 --- a/task/host-sp-comms/src/main.rs +++ b/task/host-sp-comms/src/main.rs @@ -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 {