Skip to content

Commit be2731b

Browse files
committed
style: Clippy
1 parent c6cc5fe commit be2731b

5 files changed

Lines changed: 34 additions & 44 deletions

File tree

crates/testing/test-programs/fibo/workflow/src/lib.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ impl Guest for Component {
8585
assert!(join_value.is_ok());
8686

8787
// Now get the result using get_result_json
88-
let json_result = get_result_json(&execution_id, None).expect("get_result_json should succeed");
88+
let json_result =
89+
get_result_json(&execution_id, None).expect("get_result_json should succeed");
8990

9091
// json_result is Result<Option<String>, Option<String>>
9192
// For fibo, we expect Ok(Some(json_string)) containing the u64 value
@@ -214,8 +215,8 @@ impl Guest for Component {
214215
}
215216

216217
// Now get the result using get_result_json
217-
let json_result =
218-
get_result_json(&execution_id, None).map_err(|e| format!("get_result_json failed: {e:?}"))?;
218+
let json_result = get_result_json(&execution_id, None)
219+
.map_err(|e| format!("get_result_json failed: {e:?}"))?;
219220

220221
// json_result should be Err(None) since fibo returns result<u64> (error type is unit)
221222
match json_result {
@@ -234,28 +235,16 @@ impl Guest for Component {
234235

235236
// Test 1: Schedule with ScheduleAt::Now
236237
let execution_id = execution_id_generate(None);
237-
schedule_json(
238-
&execution_id,
239-
ScheduleAt::Now,
240-
&function,
241-
"[10]",
242-
None,
243-
)
244-
.map_err(|e| format!("schedule_json failed: {e:?}"))?;
238+
schedule_json(&execution_id, ScheduleAt::Now, &function, "[10]", None)
239+
.map_err(|e| format!("schedule_json failed: {e:?}"))?;
245240

246241
// Test 2: Schedule with unknown FFQN -> FunctionNotFound
247242
let unknown_function = Function {
248243
interface_name: "testing:nonexistent/ifc".to_string(),
249244
function_name: "unknown-fn".to_string(),
250245
};
251246
let exec_id_2 = execution_id_generate(None);
252-
match schedule_json(
253-
&exec_id_2,
254-
ScheduleAt::Now,
255-
&unknown_function,
256-
"[]",
257-
None,
258-
) {
247+
match schedule_json(&exec_id_2, ScheduleAt::Now, &unknown_function, "[]", None) {
259248
Err(ScheduleJsonError::FunctionNotFound) => {}
260249
Err(other) => return Err(format!("2: expected FunctionNotFound, got {other:?}")),
261250
Ok(()) => return Err("2: expected error, got Ok".to_string()),

crates/testing/test-programs/sleep/workflow/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ impl Guest for Component {
7777
let random_millis =
7878
workflow_support::random_u64_inclusive(min_millis, max_millis_inclusive, None);
7979
let random_duration = DurationEnum::Milliseconds(random_millis);
80-
workflow_support::sleep(ScheduleAt::In(random_duration), None, None).expect("not cancelled");
80+
workflow_support::sleep(ScheduleAt::In(random_duration), None, None)
81+
.expect("not cancelled");
8182
Ok(())
8283
}
8384

@@ -88,8 +89,11 @@ impl Guest for Component {
8889

8990
fn two_delays_in_same_join_set() -> Result<(), ()> {
9091
let join_set = workflow_support::join_set_create(None);
91-
let _long =
92-
workflow_support::submit_delay(&join_set, ScheduleAt::In(DurationEnum::Seconds(10)), None);
92+
let _long = workflow_support::submit_delay(
93+
&join_set,
94+
ScheduleAt::In(DurationEnum::Seconds(10)),
95+
None,
96+
);
9397
let short = workflow_support::submit_delay(
9498
&join_set,
9599
ScheduleAt::In(DurationEnum::Milliseconds(10)),
@@ -109,7 +113,11 @@ impl Guest for Component {
109113

110114
fn join_next_produces_all_processed_error() -> Result<(), ()> {
111115
let join_set = workflow_support::join_set_create(None);
112-
workflow_support::submit_delay(&join_set, ScheduleAt::In(DurationEnum::Milliseconds(10)), None);
116+
workflow_support::submit_delay(
117+
&join_set,
118+
ScheduleAt::In(DurationEnum::Milliseconds(10)),
119+
None,
120+
);
113121
let res = workflow_support::join_next(&join_set, None).expect("join set contains 1 delay");
114122
res.expect("not cancelled");
115123
let JoinNextError::AllProcessed = workflow_support::join_next(&join_set, None).unwrap_err();

crates/wasm-workers/src/webhook/webhook_trigger.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use concepts::storage::{
1616
AppendRequest, BacktraceInfo, CreateRequest, DbConnection, DbErrorGeneric, DbErrorRead,
1717
DbErrorReadWithTimeout, DbErrorWrite, DbPool, ExecutionRequest, HistoryEvent,
1818
HistoryEventScheduleAt, JoinSetRequest, LogInfoAppendRow, LogLevel, LogStreamType,
19-
PendingState, PendingStateFinishedError,
20-
PendingStateFinishedResultKind, TimeoutOutcome, Version, http_client_trace::HttpClientTrace,
19+
PendingState, PendingStateFinishedError, PendingStateFinishedResultKind, TimeoutOutcome,
20+
Version, http_client_trace::HttpClientTrace,
2121
};
2222
use concepts::time::{ClockFn, Sleep};
2323
use concepts::{
@@ -1112,17 +1112,16 @@ impl WebhookSupportHost for WebhookEndpointCtx {
11121112
&mut self,
11131113
execution_id: types::obelisk::webhook::webhook_support::ExecutionId,
11141114
_backtrace: Option<types::obelisk::types::backtrace::WasmBacktrace>,
1115-
) -> Result<
1116-
Option<types::obelisk::types::execution::ExecutionFailureKind>,
1117-
GetErrorTrappable,
1118-
> {
1115+
) -> Result<Option<types::obelisk::types::execution::ExecutionFailureKind>, GetErrorTrappable>
1116+
{
11191117
use types::obelisk::webhook::webhook_support::GetError;
11201118

11211119
let parsed_execution_id: concepts::ExecutionId =
11221120
match concepts::ExecutionId::from_str(&execution_id.id) {
11231121
Ok(id) => id,
11241122
Err(err) => {
1125-
let msg = format!("get-execution-failure-kind: cannot parse execution ID: {err}");
1123+
let msg =
1124+
format!("get-execution-failure-kind: cannot parse execution ID: {err}");
11261125
self.error(msg.clone()).await;
11271126
return Err(GetError::ExecutionIdParsingError(msg).into());
11281127
}
@@ -1165,9 +1164,10 @@ impl WebhookSupportHost for WebhookEndpointCtx {
11651164
async fn last_direct_call_id(
11661165
&mut self,
11671166
) -> wasmtime::Result<Option<types::obelisk::webhook::webhook_support::ExecutionId>> {
1168-
Ok(self.last_direct_call_id.as_ref().map(|id| {
1169-
types::obelisk::webhook::webhook_support::ExecutionId { id: id.to_string() }
1170-
}))
1167+
Ok(self
1168+
.last_direct_call_id
1169+
.as_ref()
1170+
.map(|id| types::obelisk::webhook::webhook_support::ExecutionId { id: id.to_string() }))
11711171
}
11721172

11731173
async fn get(

crates/wasm-workers/src/workflow/event_history.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,10 +2763,7 @@ impl OneOffDelayRequest {
27632763
.next_join_set_one_off_named(suffix)
27642764
.map_err(|err| WorkflowFunctionError::ImportedFunctionCallError {
27652765
// Only `sleep-named-bt` passes the name
2766-
ffqn: FunctionFqn::new_static(
2767-
"obelisk:workflow/workflow-support@6.0.0",
2768-
"sleep",
2769-
),
2766+
ffqn: FunctionFqn::new_static("obelisk:workflow/workflow-support@6.0.0", "sleep"),
27702767
reason: "invalid sleep join set name".into(),
27712768
detail: Some(err.to_string()),
27722769
})?;

crates/wasm-workers/src/workflow/workflow_ctx.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,11 +1955,9 @@ pub(crate) mod workflow_support {
19551955
) -> Result<Option<String>, Option<String>> {
19561956
match response_id {
19571957
typesTypes::execution::ResponseId::ExecutionId(exec_id) => {
1958-
let derived = match ExecutionId::try_from(exec_id.clone()) {
1959-
Ok(ExecutionId::Derived(derived)) => derived,
1960-
_ => unreachable!(
1961-
"join-next child response id is always a derived execution id"
1962-
),
1958+
let Ok(ExecutionId::Derived(derived)) = ExecutionId::try_from(exec_id.clone())
1959+
else {
1960+
unreachable!("join-next child response id is always a derived execution id")
19631961
};
19641962
self.get_result_json(&derived)
19651963
.expect("response processed by join-next must be retrievable")
@@ -2037,9 +2035,7 @@ pub(crate) mod workflow_support {
20372035
.map(execution_failure_kind_to_wit))
20382036
}
20392037

2040-
pub(crate) fn last_direct_call_id_wit(
2041-
&self,
2042-
) -> Option<typesTypes::execution::ExecutionId> {
2038+
pub(crate) fn last_direct_call_id_wit(&self) -> Option<typesTypes::execution::ExecutionId> {
20432039
self.event_history
20442040
.last_direct_call_id()
20452041
.map(typesTypes::execution::ExecutionId::from)

0 commit comments

Comments
 (0)