refactor(tvix/nix-daemon): use if let Some(_) = …

This makes it a bit less verbose.

Change-Id: I41835f43628d7a10855b9d89816e8d20eb7546d2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12881
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: Domen Kožar <domen@cachix.org>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2024-12-09 11:14:23 +02:00 committed by clbot
parent adf9c47626
commit 12c9db5a9a

View file

@ -42,17 +42,13 @@ impl NixDaemonIO for TvixDaemon {
&self, &self,
path: &StorePath<String>, path: &StorePath<String>,
) -> Result<Option<UnkeyedValidPathInfo>> { ) -> Result<Option<UnkeyedValidPathInfo>> {
match self.path_info_service.get(*path.digest()).await? { if let Some(path_info) = self.path_info_service.get(*path.digest()).await? {
Some(path_info) => {
if path_info.store_path.name() == path.name() { if path_info.store_path.name() == path.name() {
Ok(Some(into_unkeyed_path_info(path_info))) return Ok(Some(into_unkeyed_path_info(path_info)));
} else { }
}
Ok(None) Ok(None)
} }
}
None => Ok(None),
}
}
async fn query_path_from_hash_part(&self, hash: &[u8]) -> Result<Option<UnkeyedValidPathInfo>> { async fn query_path_from_hash_part(&self, hash: &[u8]) -> Result<Option<UnkeyedValidPathInfo>> {
let digest = hash let digest = hash