chore(nix-compat/store_path): use hex_literal

Change-Id: Id093a0131aa7e3ac532daffbf5a883ca213c83ed
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9996
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
edef 2023-11-10 18:33:50 +00:00
parent 2997c1c304
commit 45de341794

View file

@ -220,6 +220,8 @@ pub fn hash_placeholder(name: &str) -> String {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use hex_literal::hex;
use super::*; use super::*;
use crate::nixhash::{CAHash, NixHash}; use crate::nixhash::{CAHash, NixHash};
@ -263,13 +265,9 @@ mod test {
fn build_sha1_path() { fn build_sha1_path() {
let outer = build_ca_path( let outer = build_ca_path(
"bar", "bar",
&CAHash::Nar(NixHash::Sha1( &CAHash::Nar(NixHash::Sha1(hex!(
data_encoding::HEXLOWER "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"
.decode(b"0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33") ))),
.expect("hex should decode")
.try_into()
.expect("should have right len"),
)),
Vec::<String>::new(), Vec::<String>::new(),
false, false,
) )
@ -294,7 +292,7 @@ mod test {
"baz", "baz",
&CAHash::Nar(NixHash::Sha256( &CAHash::Nar(NixHash::Sha256(
nixbase32::decode(b"1xqkzcb3909fp07qngljr4wcdnrh1gdam1m2n29i6hhrxlmkgkv1") nixbase32::decode(b"1xqkzcb3909fp07qngljr4wcdnrh1gdam1m2n29i6hhrxlmkgkv1")
.expect("hex should decode") .expect("nixbase32 should decode")
.try_into() .try_into()
.expect("should have right len"), .expect("should have right len"),
)), )),