From 12c9db5a9a481782c82c18408923c9a5e707933b Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 9 Dec 2024 11:14:23 +0200 Subject: refactor(tvix/nix-daemon): use if let Some(_) = … MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it a bit less verbose. Change-Id: I41835f43628d7a10855b9d89816e8d20eb7546d2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12881 Reviewed-by: Ilan Joselevich Reviewed-by: Domen Kožar Tested-by: BuildkiteCI Autosubmit: flokli --- tvix/nix-daemon/src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tvix/nix-daemon/src/lib.rs b/tvix/nix-daemon/src/lib.rs index 9a69ced1e5eb..5be8a0af7b79 100644 --- a/tvix/nix-daemon/src/lib.rs +++ b/tvix/nix-daemon/src/lib.rs @@ -42,16 +42,12 @@ impl NixDaemonIO for TvixDaemon { &self, path: &StorePath, ) -> Result> { - match self.path_info_service.get(*path.digest()).await? { - Some(path_info) => { - if path_info.store_path.name() == path.name() { - Ok(Some(into_unkeyed_path_info(path_info))) - } else { - Ok(None) - } + if let Some(path_info) = self.path_info_service.get(*path.digest()).await? { + if path_info.store_path.name() == path.name() { + return Ok(Some(into_unkeyed_path_info(path_info))); } - None => Ok(None), } + Ok(None) } async fn query_path_from_hash_part(&self, hash: &[u8]) -> Result> { -- cgit 1.4.1