From 43570bae11ff5c5fac5c644785a7c372367826ba Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 20 Feb 2024 12:12:37 +0700 Subject: refactor(tvix/store/proto): use bstr::ByteSlice String::from_utf8_lossy simply discards invalid bytes, while bstr replaces them with their replacement character. Change-Id: Ib78ff36ca5faacc1ad60bc4ddde7b62773848c07 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10981 Tested-by: BuildkiteCI Reviewed-by: Peter Kolloch Reviewed-by: flokli --- tvix/store/src/proto/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tvix/store/src/proto') diff --git a/tvix/store/src/proto/mod.rs b/tvix/store/src/proto/mod.rs index 9c8e44cfb53a..76178a7a770b 100644 --- a/tvix/store/src/proto/mod.rs +++ b/tvix/store/src/proto/mod.rs @@ -1,4 +1,5 @@ #![allow(clippy::derive_partial_eq_without_eq, non_snake_case)] +use bstr::ByteSlice; use bytes::Bytes; use data_encoding::BASE64; // https://github.com/hyperium/tonic/issues/1056 @@ -41,7 +42,7 @@ pub enum ValidatePathInfoError { InvalidRootNode(ValidateNodeError), /// Invalid node name encountered. Root nodes in PathInfos have more strict name requirements - #[error("Failed to parse {} as StorePath: {1}", String::from_utf8_lossy(.0))] + #[error("Failed to parse {} as StorePath: {1}", .0.to_str_lossy())] InvalidNodeName(Vec, store_path::Error), /// The digest in narinfo.nar_sha256 has an invalid len. -- cgit 1.4.1