From 330145fa1f05c8df5f8e940441d33edad1d77361 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 14 Oct 2024 15:51:29 +0300 Subject: refactor(nix-compat/store_path): use Path in from_absolute_path_full MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are not necessarily strings, and making it paths allows us to stop converting them to lossy strings. Change-Id: I11366c721dc5da1778aafe89092a1966b5a43178 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12617 Reviewed-by: Ilan Joselevich Reviewed-by: Jörg Thalheim Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/glue/src/tvix_store_io.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'tvix/glue/src') diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs index a09580e9b9ff..7e2ab38d7b6b 100644 --- a/tvix/glue/src/tvix_store_io.rs +++ b/tvix/glue/src/tvix_store_io.rs @@ -449,9 +449,7 @@ impl TvixStoreIO { impl EvalIO for TvixStoreIO { #[instrument(skip(self), ret(level = Level::TRACE), err)] fn path_exists(&self, path: &Path) -> io::Result { - if let Ok((store_path, sub_path)) = - StorePath::from_absolute_path_full(&path.to_string_lossy()) - { + if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) { if self .tokio_handle .block_on(self.store_path_to_node(&store_path, sub_path))? @@ -471,9 +469,7 @@ impl EvalIO for TvixStoreIO { #[instrument(skip(self), err)] fn open(&self, path: &Path) -> io::Result> { - if let Ok((store_path, sub_path)) = - StorePath::from_absolute_path_full(&path.to_string_lossy()) - { + if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) { if let Some(node) = self .tokio_handle .block_on(async { self.store_path_to_node(&store_path, sub_path).await })? @@ -527,9 +523,7 @@ impl EvalIO for TvixStoreIO { #[instrument(skip(self), ret(level = Level::TRACE), err)] fn file_type(&self, path: &Path) -> io::Result { - if let Ok((store_path, sub_path)) = - StorePath::from_absolute_path_full(&path.to_string_lossy()) - { + if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) { if let Some(node) = self .tokio_handle .block_on(async { self.store_path_to_node(&store_path, sub_path).await })? @@ -549,9 +543,7 @@ impl EvalIO for TvixStoreIO { #[instrument(skip(self), ret(level = Level::TRACE), err)] fn read_dir(&self, path: &Path) -> io::Result> { - if let Ok((store_path, sub_path)) = - StorePath::from_absolute_path_full(&path.to_string_lossy()) - { + if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) { if let Some(node) = self .tokio_handle .block_on(async { self.store_path_to_node(&store_path, sub_path).await })? -- cgit 1.4.1