Skip to content

Commit f859376

Browse files
committed
Fix lints from new Rust version
1 parent c53e487 commit f859376

22 files changed

+25
-157
lines changed

core/src/core_tests/workflow_tasks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ async fn failing_wft_doesnt_eat_permit_forever() {
15311531
variant: Some(workflow_activation_job::Variant::RemoveFromCache(_)),
15321532
},]
15331533
);
1534-
run_id = activation.run_id.clone();
1534+
run_id.clone_from(&activation.run_id);
15351535
worker
15361536
.complete_workflow_activation(WorkflowActivationCompletion::empty(activation.run_id))
15371537
.await

core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub(crate) fn init_worker_client(
122122
) -> RetryClient<Client> {
123123
let mut client = Client::new(client, config.namespace.clone());
124124
if let Some(ref id_override) = config.client_identity_override {
125-
client.options_mut().identity = id_override.clone();
125+
client.options_mut().identity.clone_from(id_override);
126126
}
127127
RetryClient::new(client, RetryConfig::default())
128128
}

core/src/telemetry/prometheus_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) struct PromServer {
2020
impl PromServer {
2121
pub(super) fn new(
2222
opts: &PrometheusExporterOptions,
23-
aggregation: impl AggregationSelector + Send + Sync + 'static,
23+
aggregation: impl AggregationSelector + 'static,
2424
) -> Result<(Self, PrometheusExporter), anyhow::Error> {
2525
let registry = Registry::new();
2626
let exporter = opentelemetry_prometheus::exporter()

core/src/worker/workflow/machines/activity_state_machine.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use temporal_sdk_core_protos::{
2828
history::v1::{
2929
history_event, ActivityTaskCanceledEventAttributes,
3030
ActivityTaskCompletedEventAttributes, ActivityTaskFailedEventAttributes,
31-
ActivityTaskTimedOutEventAttributes, HistoryEvent,
31+
ActivityTaskTimedOutEventAttributes,
3232
},
3333
},
3434
};
@@ -286,19 +286,6 @@ impl WFMachinesAdapter for ActivityMachine {
286286
}
287287
})
288288
}
289-
290-
fn matches_event(&self, event: &HistoryEvent) -> bool {
291-
matches!(
292-
event.event_type(),
293-
EventType::ActivityTaskScheduled
294-
| EventType::ActivityTaskStarted
295-
| EventType::ActivityTaskCompleted
296-
| EventType::ActivityTaskFailed
297-
| EventType::ActivityTaskTimedOut
298-
| EventType::ActivityTaskCancelRequested
299-
| EventType::ActivityTaskCanceled
300-
)
301-
}
302289
}
303290

304291
impl TryFrom<CommandType> for ActivityMachineEvents {

core/src/worker/workflow/machines/cancel_external_state_machine.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use temporal_sdk_core_protos::{
1414
command::v1::{command, Command, RequestCancelExternalWorkflowExecutionCommandAttributes},
1515
enums::v1::{CancelExternalWorkflowExecutionFailedCause, CommandType, EventType},
1616
failure::v1::{failure::FailureInfo, ApplicationFailureInfo, Failure},
17-
history::v1::{history_event, HistoryEvent},
17+
history::v1::history_event,
1818
},
1919
};
2020

@@ -210,15 +210,6 @@ impl WFMachinesAdapter for CancelExternalMachine {
210210
}
211211
})
212212
}
213-
214-
fn matches_event(&self, event: &HistoryEvent) -> bool {
215-
matches!(
216-
event.event_type(),
217-
EventType::ExternalWorkflowExecutionCancelRequested
218-
| EventType::RequestCancelExternalWorkflowExecutionFailed
219-
| EventType::RequestCancelExternalWorkflowExecutionInitiated
220-
)
221-
}
222213
}
223214

224215
impl Cancellable for CancelExternalMachine {}

core/src/worker/workflow/machines/cancel_workflow_state_machine.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{
2-
workflow_machines::MachineResponse, Cancellable, EventInfo, HistoryEvent,
3-
NewMachineWithCommand, OnEventWrapper, WFMachinesAdapter, WFMachinesError,
2+
workflow_machines::MachineResponse, Cancellable, EventInfo, NewMachineWithCommand,
3+
OnEventWrapper, WFMachinesAdapter, WFMachinesError,
44
};
55
use crate::worker::workflow::machines::HistEventData;
66
use rustfsm::{fsm, StateMachine, TransitionResult};
@@ -27,9 +27,6 @@ fsm! {
2727
--> CancelWorkflowCommandRecorded;
2828
}
2929

30-
#[derive(thiserror::Error, Debug)]
31-
pub(super) enum CancelWorkflowMachineError {}
32-
3330
#[derive(Debug, derive_more::Display)]
3431
pub(super) enum CancelWorkflowCommand {}
3532

@@ -105,10 +102,6 @@ impl WFMachinesAdapter for CancelWorkflowMachine {
105102
) -> Result<Vec<MachineResponse>, WFMachinesError> {
106103
Ok(vec![])
107104
}
108-
109-
fn matches_event(&self, event: &HistoryEvent) -> bool {
110-
event.event_type() == EventType::WorkflowExecutionCanceled
111-
}
112105
}
113106

114107
impl Cancellable for CancelWorkflowMachine {}

core/src/worker/workflow/machines/child_workflow_state_machine.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use temporal_sdk_core_protos::{
3838
history::v1::{
3939
history_event, ChildWorkflowExecutionCompletedEventAttributes,
4040
ChildWorkflowExecutionFailedEventAttributes,
41-
ChildWorkflowExecutionStartedEventAttributes, HistoryEvent,
41+
ChildWorkflowExecutionStartedEventAttributes,
4242
StartChildWorkflowExecutionFailedEventAttributes,
4343
},
4444
},
@@ -283,7 +283,7 @@ impl StartEventRecorded {
283283
event: ChildWorkflowExecutionStartedEvent,
284284
) -> ChildWorkflowMachineTransition<Started> {
285285
state.started_event_id = event.started_event_id;
286-
state.run_id = event.workflow_execution.run_id.clone();
286+
state.run_id.clone_from(&event.workflow_execution.run_id);
287287
ChildWorkflowMachineTransition::commands(vec![ChildWorkflowCommand::Start(
288288
event.workflow_execution,
289289
)])
@@ -704,20 +704,6 @@ impl WFMachinesAdapter for ChildWorkflowMachine {
704704
}
705705
})
706706
}
707-
708-
fn matches_event(&self, event: &HistoryEvent) -> bool {
709-
matches!(
710-
event.event_type(),
711-
EventType::StartChildWorkflowExecutionInitiated
712-
| EventType::StartChildWorkflowExecutionFailed
713-
| EventType::ChildWorkflowExecutionStarted
714-
| EventType::ChildWorkflowExecutionCompleted
715-
| EventType::ChildWorkflowExecutionFailed
716-
| EventType::ChildWorkflowExecutionTimedOut
717-
| EventType::ChildWorkflowExecutionTerminated
718-
| EventType::ChildWorkflowExecutionCanceled
719-
)
720-
}
721707
}
722708

723709
impl TryFrom<CommandType> for ChildWorkflowMachineEvents {

core/src/worker/workflow/machines/complete_workflow_state_machine.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use temporal_sdk_core_protos::{
1010
temporal::api::{
1111
command::v1::Command,
1212
enums::v1::{CommandType, EventType},
13-
history::v1::HistoryEvent,
1413
},
1514
};
1615

@@ -103,9 +102,6 @@ impl Created {
103102
}
104103
}
105104

106-
#[derive(thiserror::Error, Debug)]
107-
pub(super) enum CompleteWorkflowMachineError {}
108-
109105
#[derive(Default, Clone)]
110106
pub(super) struct CompleteWorkflowCommandCreated {}
111107

@@ -126,10 +122,6 @@ impl WFMachinesAdapter for CompleteWorkflowMachine {
126122
) -> Result<Vec<MachineResponse>, WFMachinesError> {
127123
Ok(vec![])
128124
}
129-
130-
fn matches_event(&self, event: &HistoryEvent) -> bool {
131-
event.event_type() == EventType::WorkflowExecutionCompleted
132-
}
133125
}
134126

135127
impl Cancellable for CompleteWorkflowMachine {}

core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::{
2-
Cancellable, EventInfo, HistoryEvent, MachineResponse, NewMachineWithCommand, OnEventWrapper,
2+
Cancellable, EventInfo, MachineResponse, NewMachineWithCommand, OnEventWrapper,
33
WFMachinesAdapter, WFMachinesError,
44
};
55
use crate::worker::workflow::machines::HistEventData;
@@ -107,10 +107,6 @@ impl WFMachinesAdapter for ContinueAsNewWorkflowMachine {
107107
) -> Result<Vec<MachineResponse>, WFMachinesError> {
108108
Ok(vec![])
109109
}
110-
111-
fn matches_event(&self, event: &HistoryEvent) -> bool {
112-
event.event_type() == EventType::WorkflowExecutionContinuedAsNew
113-
}
114110
}
115111

116112
impl Cancellable for ContinueAsNewWorkflowMachine {}

core/src/worker/workflow/machines/fail_workflow_state_machine.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use temporal_sdk_core_protos::{
1010
temporal::api::{
1111
command::v1::Command as ProtoCommand,
1212
enums::v1::{CommandType, EventType},
13-
history::v1::HistoryEvent,
1413
},
1514
};
1615

@@ -117,10 +116,6 @@ impl WFMachinesAdapter for FailWorkflowMachine {
117116
) -> Result<Vec<MachineResponse>, WFMachinesError> {
118117
Ok(vec![])
119118
}
120-
121-
fn matches_event(&self, event: &HistoryEvent) -> bool {
122-
event.event_type() == EventType::WorkflowExecutionFailed
123-
}
124119
}
125120

126121
impl Cancellable for FailWorkflowMachine {}

core/src/worker/workflow/machines/local_activity_state_machine.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use temporal_sdk_core_protos::{
3434
command::v1::{command, RecordMarkerCommandAttributes},
3535
enums::v1::{CommandType, EventType, RetryState},
3636
failure::v1::{failure::FailureInfo, Failure},
37-
history::v1::HistoryEvent,
3837
},
3938
utilities::TryIntoOrNone,
4039
};
@@ -799,10 +798,6 @@ impl WFMachinesAdapter for LocalActivityMachine {
799798
}
800799
}
801800
}
802-
803-
fn matches_event(&self, event: &HistoryEvent) -> bool {
804-
event.is_local_activity_marker()
805-
}
806801
}
807802

808803
impl TryFrom<CommandType> for LocalActivityMachineEvents {

core/src/worker/workflow/machines/mod.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ trait TemporalStateMachine {
8484
command_type: CommandType,
8585
) -> Result<Vec<MachineResponse>, WFMachinesError>;
8686

87-
/// Returns true if this machine is compatible with the provided event. Provides a way to know
88-
/// ahead of time if it's worth trying to call [TemporalStateMachine::handle_event] without
89-
/// requiring mutable access.
90-
fn matches_event(&self, event: &HistoryEvent) -> bool;
91-
9287
/// Tell the state machine to handle some event. Returns a list of responses that can be used
9388
/// to update the overall state of the workflow. EX: To issue outgoing WF activations.
9489
fn handle_event(
@@ -150,10 +145,6 @@ where
150145
}
151146
}
152147

153-
fn matches_event(&self, event: &HistoryEvent) -> bool {
154-
self.matches_event(event)
155-
}
156-
157148
fn handle_event(
158149
&mut self,
159150
event_dat: HistEventData,
@@ -240,11 +231,6 @@ trait WFMachinesAdapter: StateMachine {
240231
my_command: Self::Command,
241232
event_info: Option<EventInfo>,
242233
) -> Result<Vec<MachineResponse>, WFMachinesError>;
243-
244-
/// Returns true if this machine is compatible with the provided event. Provides a way to know
245-
/// ahead of time if it's worth trying to call [TemporalStateMachine::handle_event] without
246-
/// requiring mutable access.
247-
fn matches_event(&self, event: &HistoryEvent) -> bool;
248234
}
249235

250236
/// Wraps a history event with extra relevant data that a machine might care about while the event

core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use temporal_sdk_core_protos::{
99
temporal::api::{
1010
command::v1::Command,
1111
enums::v1::{CommandType, EventType},
12-
history::v1::HistoryEvent,
1312
},
1413
};
1514

@@ -63,10 +62,6 @@ impl WFMachinesAdapter for ModifyWorkflowPropertiesMachine {
6362
"ModifyWorkflowProperties does not use state machine commands".to_string(),
6463
))
6564
}
66-
67-
fn matches_event(&self, event: &HistoryEvent) -> bool {
68-
matches!(event.event_type(), EventType::WorkflowPropertiesModified)
69-
}
7065
}
7166

7267
impl Cancellable for ModifyWorkflowPropertiesMachine {}

core/src/worker/workflow/machines/patch_state_machine.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ use temporal_sdk_core_protos::{
4646
},
4747
common::v1::SearchAttributes,
4848
enums::v1::CommandType,
49-
history::v1::HistoryEvent,
5049
},
5150
};
5251

@@ -237,10 +236,6 @@ impl WFMachinesAdapter for PatchMachine {
237236
) -> Result<Vec<MachineResponse>, WFMachinesError> {
238237
panic!("Patch machine does not produce commands")
239238
}
240-
241-
fn matches_event(&self, event: &HistoryEvent) -> bool {
242-
event.get_patch_marker_details().is_some()
243-
}
244239
}
245240

246241
impl Cancellable for PatchMachine {}

core/src/worker/workflow/machines/signal_external_state_machine.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use temporal_sdk_core_protos::{
1919
common::v1::WorkflowExecution as UpstreamWE,
2020
enums::v1::{CommandType, EventType, SignalExternalWorkflowExecutionFailedCause},
2121
failure::v1::{failure::FailureInfo, ApplicationFailureInfo, CanceledFailureInfo, Failure},
22-
history::v1::{history_event, HistoryEvent},
22+
history::v1::history_event,
2323
},
2424
};
2525

@@ -260,15 +260,6 @@ impl WFMachinesAdapter for SignalExternalMachine {
260260
}
261261
})
262262
}
263-
264-
fn matches_event(&self, event: &HistoryEvent) -> bool {
265-
matches!(
266-
event.event_type(),
267-
EventType::ExternalWorkflowExecutionSignaled
268-
| EventType::SignalExternalWorkflowExecutionInitiated
269-
| EventType::SignalExternalWorkflowExecutionFailed
270-
)
271-
}
272263
}
273264

274265
impl Cancellable for SignalExternalMachine {

core/src/worker/workflow/machines/timer_state_machine.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use temporal_sdk_core_protos::{
1616
temporal::api::{
1717
command::v1::Command,
1818
enums::v1::{CommandType, EventType},
19-
history::v1::{history_event, HistoryEvent, TimerFiredEventAttributes},
19+
history::v1::{history_event, TimerFiredEventAttributes},
2020
},
2121
};
2222

@@ -233,13 +233,6 @@ impl WFMachinesAdapter for TimerMachine {
233233
TimerMachineCommand::IssueCancelCmd(c) => vec![MachineResponse::IssueNewCommand(c)],
234234
})
235235
}
236-
237-
fn matches_event(&self, event: &HistoryEvent) -> bool {
238-
matches!(
239-
event.event_type(),
240-
EventType::TimerStarted | EventType::TimerCanceled | EventType::TimerFired
241-
)
242-
}
243236
}
244237

245238
impl Cancellable for TimerMachine {

core/src/worker/workflow/machines/update_state_machine.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use temporal_sdk_core_protos::{
1717
common::v1::Payload,
1818
enums::v1::{CommandType, EventType},
1919
failure::v1::Failure,
20-
history::v1::HistoryEvent,
2120
protocol::v1::Message as ProtocolMessage,
2221
update::v1::{outcome, Acceptance, Outcome, Rejection, Response},
2322
},
@@ -271,15 +270,6 @@ impl WFMachinesAdapter for UpdateMachine {
271270
)?,
272271
})
273272
}
274-
275-
fn matches_event(&self, event: &HistoryEvent) -> bool {
276-
matches!(
277-
event.event_type(),
278-
EventType::WorkflowExecutionUpdateAccepted
279-
| EventType::WorkflowExecutionUpdateRejected
280-
| EventType::WorkflowExecutionUpdateCompleted
281-
)
282-
}
283273
}
284274

285275
impl TryFrom<CommandType> for UpdateMachineEvents {

0 commit comments

Comments
 (0)