From 165dac6362a655a6cd11f28bd5f1872e80ee7b63 Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Fri, 28 Nov 2025 01:03:43 -0500 Subject: [PATCH] refactor: no need to use a vec for a a static list of decryptors --- src/decryptor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/decryptor.rs b/src/decryptor.rs index 117e55c..383da86 100644 --- a/src/decryptor.rs +++ b/src/decryptor.rs @@ -11,7 +11,7 @@ use log::trace; /// Attempts to decrypt the provided data using all decryptors pub fn decrypt(encrypted_data: &[u8]) -> Result, DecryptError> { // List of supported decryptors - let decryptors: Vec<(&str, DecryptorFunction)> = vec![ + const DECRYPTORS: &[(&str, DecryptorFunction)] = &[ ("shrs", shrs::decrypt), ("mh01", mh01::decrypt), ("dlk", dlk::decrypt), @@ -22,9 +22,9 @@ pub fn decrypt(encrypted_data: &[u8]) -> Result, DecryptError> { ]; // Try each decryptor until one works - for (name, decryptor) in decryptors { + for &(name, decryptor) in DECRYPTORS { trace!("Trying decryptor: {}", name); - if let Ok(decrypted_data) = (decryptor)(encrypted_data) { + if let Ok(decrypted_data) = decryptor(encrypted_data) { return Ok(decrypted_data); } }