Skip to content

Commit

Permalink
Fix few rust linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kirugan authored and omerfirmak committed Oct 27, 2023
1 parent 822c53e commit c7b47ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions vm/rust/src/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ fn make_state_diff(
if existing_class_hash == ClassHash::default() {
#[rustfmt::skip]
deployed_contracts.push(DeployedContract {
address: pair.0.0.key().clone(),
address: *pair.0.0.key(),
class_hash: pair.1.0,
});
} else {
#[rustfmt::skip]
replaced_classes.push(ReplacedClass {
contract_address: pair.0.0.key().clone(),
contract_address: *pair.0.0.key(),
class_hash: pair.1.0,
});
}
Expand All @@ -315,9 +315,9 @@ fn make_state_diff(
deployed_contracts,
#[rustfmt::skip]
storage_diffs: diff.storage_updates.into_iter().map(| v | StorageDiff {
address: v.0.0.key().clone(),
address: *v.0.0.key(),
storage_entries: v.1.into_iter().map(| e | Entry {
key: e.0.0.key().clone(),
key: *e.0.0.key(),
value: e.1
}).collect()
}).collect(),
Expand All @@ -329,7 +329,7 @@ fn make_state_diff(
deprecated_declared_classes,
#[rustfmt::skip]
nonces: diff.address_to_nonce.into_iter().map(| v | Nonce {
contract_address: v.0.0.key().clone(),
contract_address: *v.0.0.key(),
nonce: v.1.0,
}).collect(),
replaced_classes,
Expand Down
8 changes: 4 additions & 4 deletions vm/rust/src/juno_state_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ pub fn contract_class_from_json_str(raw_json: &str) -> Result<ContractClass, Str
let v0_class = ContractClassV0::try_from_json_string(raw_json);
let v1_class = ContractClassV1::try_from_json_string(raw_json);

if v0_class.is_ok() {
Ok(v0_class.unwrap().into())
} else if v1_class.is_ok() {
Ok(v1_class.unwrap().into())
if let Ok(class) = v0_class {
Ok(class.into())
} else if let Ok(class) = v1_class {
Ok(class.into())
} else {
Err("not a valid contract class".to_string())
}
Expand Down

0 comments on commit c7b47ed

Please sign in to comment.