Skip to content

Commit

Permalink
fmt clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Mar 15, 2024
1 parent 2be1943 commit dd5ea48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ mod mocks;
pub use clean::Clean;
pub use command::Command;
pub use compiler::execute;
pub use new::New;
pub use gas_meter::TestInitiaGasMeter;
pub use new::New;

#[cfg(test)]
mod tests;
10 changes: 5 additions & 5 deletions crates/natives/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn native_query_custom(
})?;

#[cfg(feature = "testing")]
if name.len() > 0 {
if !name.is_empty() {
match name.as_str() {
"to_sdk_address" => {
return to_sdk_address(&data);
Expand Down Expand Up @@ -217,7 +217,7 @@ struct FromSDKAddressResponse {
#[cfg(feature = "testing")]
fn to_sdk_address(data: &[u8]) -> SafeNativeResult<SmallVec<[Value; 1]>> {
let req: ToSDKAddressRequest =
serde_json::from_slice(&data).map_err(|_| SafeNativeError::Abort {
serde_json::from_slice(data).map_err(|_| SafeNativeError::Abort {
abort_code: UNABLE_TO_PARSE_STRING,
})?;
let vm_addr =
Expand All @@ -231,13 +231,13 @@ fn to_sdk_address(data: &[u8]) -> SafeNativeResult<SmallVec<[Value; 1]>> {

let sdk_addr = bech32::encode::<Bech32>(Hrp::parse_unchecked("init"), addr_bytes).unwrap();
let res_bytes = serde_json::to_vec(&ToSDKAddressResponse { sdk_addr }).unwrap();
return Ok(smallvec![Value::vector_u8(res_bytes)]);
Ok(smallvec![Value::vector_u8(res_bytes)])
}

#[cfg(feature = "testing")]
fn from_sdk_address(data: &[u8]) -> SafeNativeResult<SmallVec<[Value; 1]>> {
let req: FromSDKAddressRequest =
serde_json::from_slice(&data).map_err(|_| SafeNativeError::Abort {
serde_json::from_slice(data).map_err(|_| SafeNativeError::Abort {
abort_code: UNABLE_TO_PARSE_STRING,
})?;
let (_, mut addr_bytes) =
Expand All @@ -257,5 +257,5 @@ fn from_sdk_address(data: &[u8]) -> SafeNativeResult<SmallVec<[Value; 1]>> {
vm_addr: vm_addr.to_canonical_string(),
})
.unwrap();
return Ok(smallvec![Value::vector_u8(res_bytes)]);
Ok(smallvec![Value::vector_u8(res_bytes)])
}

0 comments on commit dd5ea48

Please sign in to comment.