From 0c7d998b10f4b038ea1c259db23b9ced1619a27a Mon Sep 17 00:00:00 2001 From: alenmestrov Date: Wed, 18 Dec 2024 13:01:13 +0100 Subject: [PATCH] fix: clippy warnings/errors --- .../src/client/env/proxy/types/starknet.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/context/config/src/client/env/proxy/types/starknet.rs b/crates/context/config/src/client/env/proxy/types/starknet.rs index 2d83f71fa..9feae1095 100644 --- a/crates/context/config/src/client/env/proxy/types/starknet.rs +++ b/crates/context/config/src/client/env/proxy/types/starknet.rs @@ -39,7 +39,7 @@ impl Encode for ContextVariableKey { // Use exactly 16 bytes per chunk let chunk_size = 16; - #[allow(clippy::integer_division)] + #[allow(clippy::integer_division, reason = "Using integer division for ceiling division calculation")] let num_chunks = (bytes.len() + chunk_size - 1) / chunk_size; // Write number of chunks first @@ -289,19 +289,22 @@ impl From> for StarknetProposalActionWithArgs { serde_json::Value::Object(map) => { // For objects, serialize each value to a felt map.into_iter() - .map(|(_, value)| { - Felt::from_bytes_be_slice(value.to_string().as_bytes()) - }) + .map(|(_, value)| Felt::from_bytes_be_slice(value.to_string().as_bytes())) .collect() - } + }, serde_json::Value::Array(arr) => { // For arrays, convert each element arr.into_iter() .map(|value| Felt::from_bytes_be_slice(value.to_string().as_bytes())) .collect() - } - // Single value - value => vec![Felt::from_bytes_be_slice(value.to_string().as_bytes())], + }, + // Explicitly match all other variants + value @ (serde_json::Value::Null + | serde_json::Value::Bool(_) + | serde_json::Value::Number(_) + | serde_json::Value::String(_)) => { + vec![Felt::from_bytes_be_slice(value.to_string().as_bytes())] + }, }; StarknetProposalActionWithArgs::ExternalFunctionCall(