about summary refs log tree commit diff
path: root/tvix/nix-compat/src/store_path
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2023-11-10T18·33+0000
committeredef <edef@edef.eu>2023-11-10T19·35+0000
commit45de341794b95db2e8af6dec6a8fe279cfb6c67c (patch)
treedea3eae2d72872cff909aca2e44c86e772423a86 /tvix/nix-compat/src/store_path
parent2997c1c3047d4a9cd9873a28a3e477bd956f0e23 (diff)
chore(nix-compat/store_path): use hex_literal r/6987
Change-Id: Id093a0131aa7e3ac532daffbf5a883ca213c83ed
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9996
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/store_path')
-rw-r--r--tvix/nix-compat/src/store_path/utils.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/tvix/nix-compat/src/store_path/utils.rs b/tvix/nix-compat/src/store_path/utils.rs
index 44e4e4a59e94..a227056edc21 100644
--- a/tvix/nix-compat/src/store_path/utils.rs
+++ b/tvix/nix-compat/src/store_path/utils.rs
@@ -220,6 +220,8 @@ pub fn hash_placeholder(name: &str) -> String {
 
 #[cfg(test)]
 mod test {
+    use hex_literal::hex;
+
     use super::*;
     use crate::nixhash::{CAHash, NixHash};
 
@@ -263,13 +265,9 @@ mod test {
     fn build_sha1_path() {
         let outer = build_ca_path(
             "bar",
-            &CAHash::Nar(NixHash::Sha1(
-                data_encoding::HEXLOWER
-                    .decode(b"0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33")
-                    .expect("hex should decode")
-                    .try_into()
-                    .expect("should have right len"),
-            )),
+            &CAHash::Nar(NixHash::Sha1(hex!(
+                "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"
+            ))),
             Vec::<String>::new(),
             false,
         )
@@ -294,7 +292,7 @@ mod test {
             "baz",
             &CAHash::Nar(NixHash::Sha256(
                 nixbase32::decode(b"1xqkzcb3909fp07qngljr4wcdnrh1gdam1m2n29i6hhrxlmkgkv1")
-                    .expect("hex should decode")
+                    .expect("nixbase32 should decode")
                     .try_into()
                     .expect("should have right len"),
             )),