Skip to content

Commit

Permalink
chore: remove redundant clones (#1500)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-starkware authored Oct 21, 2024
1 parent 75d1da2 commit f800c3a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions crates/papyrus_rpc/src/v0_8/api/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ async fn get_block_w_full_transactions() {
block.header.block_hash = block_hash;
block.header.block_header_without_hash.sequencer = sequencer_address;
block.header.block_header_without_hash.timestamp = timestamp;
block.header.block_header_without_hash.starknet_version = starknet_version.clone();
block.header.block_header_without_hash.starknet_version = starknet_version;
storage_writer
.begin_rw_txn()
.unwrap()
Expand Down Expand Up @@ -685,7 +685,7 @@ async fn get_block_w_full_transactions_and_receipts() {
block.header.block_hash = block_hash;
block.header.block_header_without_hash.sequencer = sequencer_address;
block.header.block_header_without_hash.timestamp = timestamp;
block.header.block_header_without_hash.starknet_version = starknet_version.clone();
block.header.block_header_without_hash.starknet_version = starknet_version;
storage_writer
.begin_rw_txn()
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_storage/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl<'env> HeaderStorageWriter for StorageTxn<'env, RW> {
sequencer: block_header.block_header_without_hash.sequencer,
timestamp: block_header.block_header_without_hash.timestamp,
l1_da_mode: block_header.block_header_without_hash.l1_da_mode,
state_diff_commitment: block_header.state_diff_commitment.clone(),
state_diff_commitment: block_header.state_diff_commitment,
transaction_commitment: block_header.transaction_commitment,
event_commitment: block_header.event_commitment,
receipt_commitment: block_header.receipt_commitment,
Expand Down
8 changes: 4 additions & 4 deletions crates/papyrus_storage/src/header_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ async fn starknet_version() {
.unwrap()
.append_header(BlockNumber(1), &block_header(1, StarknetVersion::default()))
.unwrap()
.append_header(BlockNumber(2), &block_header(2, second_version.clone()))
.append_header(BlockNumber(2), &block_header(2, second_version))
.unwrap()
.append_header(BlockNumber(3), &block_header(3, second_version.clone()))
.append_header(BlockNumber(3), &block_header(3, second_version))
.unwrap()
.append_header(BlockNumber(4), &block_header(4, yet_another_version.clone()))
.append_header(BlockNumber(4), &block_header(4, yet_another_version))
.unwrap()
.append_header(BlockNumber(5), &block_header(5, yet_another_version.clone()))
.append_header(BlockNumber(5), &block_header(5, yet_another_version))
.unwrap()
.commit()
.unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub fn calculate_block_hash(
header: BlockHeaderWithoutHash,
block_commitments: BlockHeaderCommitments,
) -> StarknetApiResult<BlockHash> {
let block_hash_version: BlockHashVersion = header.starknet_version.clone().try_into()?;
let block_hash_version: BlockHashVersion = header.starknet_version.try_into()?;
Ok(BlockHash(
HashChain::new()
.chain(&block_hash_version.clone().into())
Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_client/src/reader/objects/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl Block {

pub fn starknet_version(&self) -> StarknetVersion {
match self {
Block::PostV0_13_1(block) => block.starknet_version.clone(),
Block::PostV0_13_1(block) => block.starknet_version,
}
}

Expand All @@ -251,7 +251,7 @@ impl Block {
match self {
// TODO(shahak): in SN API, make StateDiffCommitment implement Copy and remove this
// clone.
Block::PostV0_13_1(block) => block.state_diff_commitment.clone(),
Block::PostV0_13_1(block) => block.state_diff_commitment,
}
}

Expand Down

0 comments on commit f800c3a

Please sign in to comment.