Skip to content

Commit 419f372

Browse files
authored
Update to new rust / fix clippy lints / use a few new features (#946)
1 parent fd3d397 commit 419f372

File tree

15 files changed

+32
-36
lines changed

15 files changed

+32
-36
lines changed

.cargo/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@ integ-test = ["test", "--features", "temporal-sdk-core-protos/serde_serialize",
88
lint = ["clippy", "--workspace", "--examples", "--all-features",
99
"--test", "integ_tests", "--test", "heavy_tests", "--test", "manual_tests",
1010
"--", "--D", "warnings"]
11+
lint-fix = ["clippy", "--workspace", "--examples", "--all-features",
12+
"--test", "integ_tests", "--test", "heavy_tests", "--test", "manual_tests",
13+
"--fix", "--allow-dirty"]
1114
test-lint = ["clippy", "--all", "--all-features", "--examples", "--workspace",
1215
"--tests", "--", "--D", "warnings"]
16+
test-lint-fix = ["clippy", "--all", "--all-features", "--examples", "--workspace",
17+
"--tests", "--fix", "--allow-dirty"]

.github/workflows/per-pr.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
submodules: recursive
2222
- uses: dtolnay/rust-toolchain@stable
2323
with:
24-
toolchain: 1.87.0
24+
toolchain: 1.88.0
2525
- name: Install protoc
2626
uses: arduino/setup-protoc@v3
2727
with:
@@ -56,7 +56,7 @@ jobs:
5656
- uses: actions/checkout@v4
5757
- uses: dtolnay/rust-toolchain@stable
5858
with:
59-
toolchain: 1.87.0
59+
toolchain: 1.88.0
6060
- name: Install protoc
6161
uses: arduino/setup-protoc@v3
6262
with:
@@ -104,7 +104,7 @@ jobs:
104104
- uses: actions/checkout@v4
105105
- uses: dtolnay/rust-toolchain@stable
106106
with:
107-
toolchain: 1.87.0
107+
toolchain: 1.88.0
108108
- name: Install protoc
109109
uses: arduino/setup-protoc@v3
110110
with:
@@ -129,7 +129,7 @@ jobs:
129129
- uses: actions/checkout@v4
130130
- uses: dtolnay/rust-toolchain@stable
131131
with:
132-
toolchain: 1.87.0
132+
toolchain: 1.88.0
133133
- name: Install protoc
134134
uses: arduino/setup-protoc@v3
135135
with:
@@ -154,7 +154,7 @@ jobs:
154154
- uses: actions/checkout@v4
155155
- uses: dtolnay/rust-toolchain@stable
156156
with:
157-
toolchain: 1.87.0
157+
toolchain: 1.88.0
158158
- name: Install protoc
159159
uses: arduino/setup-protoc@v3
160160
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ src/protos/*.rs
2222
# Keep secrets here
2323
/.cloud_certs/
2424
cloud_envs.fish
25+
/.claude/settings.local.json

client/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl ClientHeaders {
386386
if let Some(api_key) = &self.api_key {
387387
// Only if not already present
388388
if !metadata.contains_key("authorization") {
389-
if let Ok(val) = format!("Bearer {}", api_key).parse() {
389+
if let Ok(val) = format!("Bearer {api_key}").parse() {
390390
metadata.insert("authorization", val);
391391
}
392392
}
@@ -512,7 +512,7 @@ impl ClientOptions {
512512
// up correct on requests while we use TLS. Setting the header directly in our
513513
// interceptor doesn't work since seemingly it is overridden at some point by
514514
// something lower level.
515-
let uri: Uri = format!("https://{}", domain).parse()?;
515+
let uri: Uri = format!("https://{domain}").parse()?;
516516
channel = channel.origin(uri);
517517
}
518518

client/src/proxy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ impl HttpConnectProxyOptions {
4545
// Create CONNECT request
4646
let mut req_build = hyper::Request::builder().method("CONNECT").uri(uri);
4747
if let Some((user, pass)) = &self.basic_auth {
48-
let creds = BASE64_STANDARD.encode(format!("{}:{}", user, pass));
49-
req_build = req_build.header(header::PROXY_AUTHORIZATION, format!("Basic {}", creds));
48+
let creds = BASE64_STANDARD.encode(format!("{user}:{pass}"));
49+
req_build = req_build.header(header::PROXY_AUTHORIZATION, format!("Basic {creds}"));
5050
}
5151
let req = req_build.body(Empty::<Bytes>::new())?;
5252

client/src/workflow_handle/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ where
3939
pub fn unwrap_success(self) -> T {
4040
match self {
4141
Self::Succeeded(t) => t,
42-
o => panic!("Expected success, got {:?}", o),
42+
o => panic!("Expected success, got {o:?}"),
4343
}
4444
}
4545
}

core-api/src/envconfig.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,7 @@ fn apply_data_source_env_var(
477477

478478
if has_path_env && has_data_env {
479479
return Err(ConfigError::InvalidConfig(format!(
480-
"Cannot specify both {} and {}",
481-
path_var, data_var
480+
"Cannot specify both {path_var} and {data_var}"
482481
)));
483482
}
484483

@@ -488,8 +487,7 @@ fn apply_data_source_env_var(
488487
.is_some_and(|s| matches!(s, DataSource::Path(_)))
489488
{
490489
return Err(ConfigError::InvalidConfig(format!(
491-
"Cannot specify {0} data via {1} when {0} path is already specified",
492-
name, data_var
490+
"Cannot specify {name} data via {data_var} when {name} path is already specified"
493491
)));
494492
}
495493
*dest = Some(DataSource::Data(
@@ -501,8 +499,7 @@ fn apply_data_source_env_var(
501499
.is_some_and(|s| matches!(s, DataSource::Data(_)))
502500
{
503501
return Err(ConfigError::InvalidConfig(format!(
504-
"Cannot specify {0} path via {1} when {0} data is already specified",
505-
name, path_var
502+
"Cannot specify {name} path via {path_var} when {name} data is already specified"
506503
)));
507504
}
508505
*dest = Some(DataSource::Path(env_vars.get(path_var).unwrap().clone()));

core/src/telemetry/metrics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,10 @@ impl Display for FailureReason {
556556
FailureReason::Nondeterminism => "NonDeterminismError".to_owned(),
557557
FailureReason::Workflow => "WorkflowError".to_owned(),
558558
FailureReason::Timeout => "timeout".to_owned(),
559-
FailureReason::NexusOperation(op) => format!("operation_{}", op),
560-
FailureReason::NexusHandlerError(op) => format!("handler_error_{}", op),
559+
FailureReason::NexusOperation(op) => format!("operation_{op}"),
560+
FailureReason::NexusHandlerError(op) => format!("handler_error_{op}"),
561561
};
562-
write!(f, "{}", str)
562+
write!(f, "{str}")
563563
}
564564
}
565565
impl From<WorkflowTaskFailedCause> for FailureReason {

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,7 @@ impl StartCommandCreated {
259259
) -> ChildWorkflowMachineTransition<Cancelled> {
260260
state.cancelled_before_sent = true;
261261
ChildWorkflowMachineTransition::commands(vec![ChildWorkflowCommand::StartCancel(Failure {
262-
message: format!(
263-
"Child Workflow Execution cancelled before scheduled: {}",
264-
reason
265-
),
262+
message: format!("Child Workflow Execution cancelled before scheduled: {reason}"),
266263
cause: Some(Box::new(Failure {
267264
failure_info: Some(FailureInfo::CanceledFailureInfo(
268265
failure::CanceledFailureInfo {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl UpdateMachine {
173173
msg: UpdateMsg,
174174
) -> Result<MachineResponse, WFMachinesError> {
175175
let accept_body = msg.pack().map_err(|e| {
176-
WFMachinesError::Fatal(format!("Failed to serialize update response: {:?}", e))
176+
WFMachinesError::Fatal(format!("Failed to serialize update response: {e:?}"))
177177
})?;
178178
Ok(MachineResponse::IssueNewMessage(ProtocolMessage {
179179
id: outgoing_id.clone(),

0 commit comments

Comments
 (0)