Skip to content

Commit 68faeea

Browse files
committed
workspace: add Copy derive to fieldless enums and all-Copy structs
1 parent 184cc8c commit 68faeea

File tree

22 files changed

+38
-39
lines changed

22 files changed

+38
-39
lines changed

crates/apollo_consensus_orchestrator_config/src/config.rs

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

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

crates/apollo_dashboard/src/panel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) enum PanelType {
2424
BarGauge,
2525
}
2626

27-
#[derive(Debug, Clone, PartialEq)]
27+
#[derive(Debug, Clone, Copy, PartialEq)]
2828
pub enum Unit {
2929
Bytes,
3030
Seconds,
@@ -53,7 +53,7 @@ impl Serialize for Unit {
5353
}
5454
}
5555

56-
#[derive(Clone, Debug, PartialEq, Serialize)]
56+
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
5757
#[serde(rename_all = "lowercase")]
5858
pub enum ThresholdMode {
5959
#[allow(dead_code)] // TODO(Ron): use in panels

crates/apollo_gateway/src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn create_sierra_program(version_id: &VersionId) -> Vec<Felt> {
4848
]
4949
}
5050

51-
#[derive(Clone)]
51+
#[derive(Clone, Copy)]
5252
pub enum TransactionType {
5353
Declare,
5454
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
@@ -653,7 +653,7 @@ fn create_wrapper_servers(
653653
components: &mut SequencerNodeComponents,
654654
) -> WrapperServers {
655655
let config_manager_runner_server = create_wrapper_server!(
656-
&config.components.config_manager.execution_mode.clone().into(),
656+
&config.components.config_manager.execution_mode.into(),
657657
components.config_manager_runner
658658
);
659659

@@ -681,12 +681,12 @@ fn create_wrapper_servers(
681681
);
682682

683683
let mempool_p2p_runner_server = create_wrapper_server!(
684-
&config.components.mempool_p2p.execution_mode.clone().into(),
684+
&config.components.mempool_p2p.execution_mode.into(),
685685
components.mempool_p2p_runner
686686
);
687687

688688
let state_sync_runner_server = create_wrapper_server!(
689-
&config.components.state_sync.execution_mode.clone().into(),
689+
&config.components.state_sync.execution_mode.into(),
690690
components.state_sync_runner
691691
);
692692

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
@@ -863,7 +863,7 @@ pub struct L1HandlerTransactionOutput {
863863
// Note: This is not the same as the Builtins in starknet_api, the serialization of SegmentArena is
864864
// different.
865865
// TODO(yair): remove this once a newer version of the API is published.
866-
#[derive(Debug, Clone, Eq, Hash, PartialEq, Deserialize, Serialize, PartialOrd, Ord)]
866+
#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, Deserialize, Serialize, PartialOrd, Ord)]
867867
pub enum Builtin {
868868
#[serde(rename = "range_check_builtin_applications")]
869869
RangeCheck,
@@ -949,7 +949,7 @@ impl Add for ExecutionResources {
949949
// and not as the trait Add.
950950
Some(v_ref) => *v_ref = (*v_ref).saturating_add((*v).into()),
951951
None => {
952-
self.computation_resources.builtin_instance_counter.insert(k.clone(), *v);
952+
self.computation_resources.builtin_instance_counter.insert(*k, *v);
953953
}
954954
}
955955
}

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);

0 commit comments

Comments
 (0)