From 87d80eb1cc69e92be55ae4dc81459f2a993eda2f Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 3 Jun 2025 23:18:29 +0300 Subject: [PATCH] refactor(nix-compat/nixhash): absorb to_plain_hex_string This is only used inside NixHash::to_nix_hex_string(). Change-Id: I7c9c0cd7d4feaa41b0861bb5c0e99a47ec0caac1 Reviewed-on: https://cl.snix.dev/c/snix/+/30555 Autosubmit: Florian Klink Tested-by: besadii Reviewed-by: Ilan Joselevich --- snix/nix-compat/src/nixhash/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/snix/nix-compat/src/nixhash/mod.rs b/snix/nix-compat/src/nixhash/mod.rs index edb34e57b..2be8caa10 100644 --- a/snix/nix-compat/src/nixhash/mod.rs +++ b/snix/nix-compat/src/nixhash/mod.rs @@ -93,7 +93,11 @@ impl NixHash { /// Formats a [NixHash] in the Nix default hash format, /// which is the algo, followed by a colon, then the lower hex encoded digest. pub fn to_nix_hex_string(&self) -> String { - format!("{}:{}", self.algo(), self.to_plain_hex_string()) + format!( + "{}:{}", + self.algo(), + HEXLOWER.encode(self.digest_as_bytes()) + ) } /// Formats a [NixHash] in the format that's used inside CAHash, @@ -123,11 +127,6 @@ impl NixHash { s } - - /// Returns the digest as a hex string -- without any algorithm prefix. - pub fn to_plain_hex_string(&self) -> String { - HEXLOWER.encode(self.digest_as_bytes()) - } } impl<'de> Deserialize<'de> for NixHash {