Skip to content

Commit 6568e95

Browse files
committed
workspace: add Copy derive to fieldless enums and all-Copy structs
1 parent 07a007d commit 6568e95

File tree

21 files changed

+36
-37
lines changed

21 files changed

+36
-37
lines changed

crates/apollo_consensus_orchestrator_config/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use starknet_api::core::{ChainId, ContractAddress};
2020
use url::Url;
2121
use validator::Validate;
2222

23-
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
23+
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
2424
#[serde(rename_all = "lowercase")]
2525
pub enum DeploymentMode {
2626
// Production mode.

crates/apollo_gateway/src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn create_sierra_program(version_id: &VersionId) -> Vec<Felt> {
5555
]
5656
}
5757

58-
#[derive(Clone)]
58+
#[derive(Clone, Copy)]
5959
pub enum TransactionType {
6060
Declare,
6161
DeployAccount,

crates/apollo_l1_provider_types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl std::fmt::Display for ProviderState {
451451
}
452452
}
453453

454-
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
454+
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
455455
pub enum SessionState {
456456
Propose,
457457
Validate,

crates/apollo_node/src/servers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ fn create_wrapper_servers(
685685
components: &mut SequencerNodeComponents,
686686
) -> WrapperServers {
687687
let config_manager_runner_server = create_wrapper_server!(
688-
&config.components.config_manager.execution_mode.clone().into(),
688+
&config.components.config_manager.execution_mode.into(),
689689
components.config_manager_runner
690690
);
691691

@@ -713,12 +713,12 @@ fn create_wrapper_servers(
713713
);
714714

715715
let mempool_p2p_runner_server = create_wrapper_server!(
716-
&config.components.mempool_p2p.execution_mode.clone().into(),
716+
&config.components.mempool_p2p.execution_mode.into(),
717717
components.mempool_p2p_runner
718718
);
719719

720720
let state_sync_runner_server = create_wrapper_server!(
721-
&config.components.state_sync.execution_mode.clone().into(),
721+
&config.components.state_sync.execution_mode.into(),
722722
components.state_sync_runner
723723
);
724724

crates/apollo_node_config/src/component_execution_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait ExpectedComponentConfig {
2727
fn is_running_locally(&self) -> bool;
2828
}
2929

30-
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
30+
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
3131
pub enum ReactiveComponentExecutionMode {
3232
Disabled,
3333
Remote,
@@ -47,7 +47,7 @@ impl ExpectedComponentConfig for ReactiveComponentExecutionMode {
4747
}
4848
}
4949

50-
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
50+
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
5151
pub enum ActiveComponentExecutionMode {
5252
Disabled,
5353
Enabled,

crates/apollo_rpc/src/v0_8/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ pub struct L1HandlerTransactionOutput {
868868
// Note: This is not the same as the Builtins in starknet_api, the serialization of SegmentArena is
869869
// different.
870870
// TODO(yair): remove this once a newer version of the API is published.
871-
#[derive(Debug, Clone, Eq, Hash, PartialEq, Deserialize, Serialize, PartialOrd, Ord)]
871+
#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, Deserialize, Serialize, PartialOrd, Ord)]
872872
pub enum Builtin {
873873
#[serde(rename = "range_check_builtin_applications")]
874874
RangeCheck,
@@ -954,7 +954,7 @@ impl Add for ExecutionResources {
954954
// and not as the trait Add.
955955
Some(v_ref) => *v_ref = (*v_ref).saturating_add((*v).into()),
956956
None => {
957-
self.computation_resources.builtin_instance_counter.insert(k.clone(), *v);
957+
self.computation_resources.builtin_instance_counter.insert(*k, *v);
958958
}
959959
}
960960
}

crates/blockifier/src/blockifier/concurrent_transaction_executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<S: StateReader + Send + 'static> ConcurrentTransactionExecutor<S> {
4848
&block_context.versioned_constants.os_constants,
4949
)?;
5050

51-
let bouncer_config = block_context.bouncer_config.clone();
51+
let bouncer_config = block_context.bouncer_config;
5252
let worker_executor = Arc::new(WorkerExecutor::initialize(
5353
block_state,
5454
vec![],
@@ -70,7 +70,7 @@ impl<S: StateReader + Send + 'static> ConcurrentTransactionExecutor<S> {
7070
worker_pool: Arc<WorkerPool<CachedState<S>>>,
7171
block_deadline: Option<Instant>,
7272
) -> Self {
73-
let bouncer_config = block_context.bouncer_config.clone();
73+
let bouncer_config = block_context.bouncer_config;
7474
let worker_executor = Arc::new(WorkerExecutor::initialize(
7575
block_state,
7676
vec![],

crates/blockifier/src/blockifier/transaction_executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<S: StateReader> TransactionExecutor<S> {
130130
config: TransactionExecutorConfig,
131131
worker_pool: Option<Arc<WorkerPool<CachedState<S>>>>,
132132
) -> Self {
133-
let bouncer_config = block_context.bouncer_config.clone();
133+
let bouncer_config = block_context.bouncer_config;
134134
// Note: the state might not be empty even at this point; it is the creator's
135135
// responsibility to tune the bouncer according to pre and post block process.
136136
Self {

crates/blockifier/src/blockifier/transaction_executor_test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ fn test_execute_txs_bouncing(#[case] concurrency_enabled: bool, #[case] external
378378
assert_eq!(remaining_tx_results.len(), 0);
379379

380380
// Reset the bouncer and add the remaining transactions.
381-
tx_executor.bouncer =
382-
Mutex::new(Bouncer::new(tx_executor.block_context.bouncer_config.clone())).into();
381+
tx_executor.bouncer = Mutex::new(Bouncer::new(tx_executor.block_context.bouncer_config)).into();
383382
let remaining_tx_results = tx_executor.execute_txs(remaining_txs, None);
384383

385384
assert_eq!(remaining_tx_results.len(), 2);

crates/blockifier/src/bouncer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ macro_rules! impl_field_wise_ops {
7070
};
7171
}
7272

73-
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
73+
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize)]
7474
pub struct BouncerConfig {
7575
pub block_max_capacity: BouncerWeights,
7676
pub builtin_weights: BuiltinWeights,

0 commit comments

Comments
 (0)