about summary refs log tree commit diff
path: root/tvix/nix-compat/src/store_path
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nix-compat/src/store_path')
-rw-r--r--tvix/nix-compat/src/store_path/mod.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/tvix/nix-compat/src/store_path/mod.rs b/tvix/nix-compat/src/store_path/mod.rs
index e2c1de8a95c6..faa2280e597d 100644
--- a/tvix/nix-compat/src/store_path/mod.rs
+++ b/tvix/nix-compat/src/store_path/mod.rs
@@ -203,10 +203,8 @@ impl<'a> StorePathRef<'a> {
             Err(Error::InvalidLength)?
         }
 
-        let digest = match nixbase32::decode(&s[..ENCODED_DIGEST_SIZE]) {
-            Ok(decoded) => decoded,
-            Err(decoder_error) => return Err(Error::InvalidHashEncoding(decoder_error)),
-        };
+        let digest = nixbase32::decode_fixed(&s[..ENCODED_DIGEST_SIZE])
+            .map_err(Error::InvalidHashEncoding)?;
 
         if s[ENCODED_DIGEST_SIZE] != b'-' {
             return Err(Error::MissingDash);