Skip to content

Commit

Permalink
fix: clippy warnings/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alenmestrov committed Dec 18, 2024
1 parent 5bb8a9b commit 0c7d998
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions crates/context/config/src/client/env/proxy/types/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -289,19 +289,22 @@ impl From<Vec<ProposalAction>> 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(
Expand Down

0 comments on commit 0c7d998

Please sign in to comment.