Skip to content

Commit 2ad5f1b

Browse files
committed
chore: Use modern Rust formatting conventions
1 parent a99aba9 commit 2ad5f1b

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/cloud/digitalocean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl Provisioner for DigitalOceanProvisioner {
181181
.and_then(|status| status.id.as_ref());
182182

183183
if let Some(droplet_id) = droplet_id {
184-
info!("Deleting droplet with ID {}", droplet_id);
184+
info!("Deleting droplet with ID {droplet_id}");
185185
api.delete_droplet_async(droplet_id).await?;
186186
}
187187
Ok(())

src/cloud/linode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Provisioner for LinodeProvisioner {
9292
.root_pass(root_password)
9393
.label(&name)
9494
.user_data(&user_data)
95-
.tags(vec![format!("chisel-operator-provisioner:{}", provisioner)])
95+
.tags(vec![format!("chisel-operator-provisioner:{provisioner}")])
9696
.image(IMAGE_ID)
9797
.booted(true)
9898
.run_async()
@@ -143,7 +143,7 @@ impl Provisioner for LinodeProvisioner {
143143
// okay, so Linode IDs will be u64, so let's parse it
144144

145145
if let Some(instance_id) = instance_id {
146-
info!("Deleting Linode instance with ID {}", instance_id);
146+
info!("Deleting Linode instance with ID {instance_id}");
147147
api.delete_instance_async(instance_id).await?;
148148
}
149149

src/daemon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ async fn exit_node_for_service(
379379
.and_then(|annotations| annotations.get(EXIT_NODE_NAME_ANNOTATION))
380380
.unwrap_or({
381381
let service_name = service.metadata.name.as_ref().unwrap();
382-
&format!("service-{}", service_name)
382+
&format!("service-{service_name}")
383383
})
384384
.to_owned();
385385

@@ -652,7 +652,7 @@ async fn reconcile_svcs(obj: Arc<Service>, ctx: Arc<Context>) -> Result<Action,
652652
.map_err(|e| {
653653
crate::error::ReconcileError::KubeError(kube::Error::Api(kube::error::ErrorResponse {
654654
code: 500,
655-
message: format!("Error applying finalizer for {}", obj.name_any()),
655+
message: "Error applying finalizer".to_string(),
656656
reason: e.to_string(),
657657
status: "Failure".to_string(),
658658
}))

src/deployment.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ pub fn generate_remote_arg(node: &ExitNode) -> String {
8282

8383
// Determine if the host is an IPv6 address and format accordingly
8484
let formatted_host = match host.parse::<IpAddr>() {
85-
Ok(IpAddr::V6(_)) => format!("[{}]", host),
85+
Ok(IpAddr::V6(_)) => format!("[{host}]"),
8686
_ => host.to_string(),
8787
};
8888

89-
let output = format!("{}:{}", formatted_host, node.spec.port);
89+
let output = format!("{formatted_host}:{}", node.spec.port);
9090
trace!(output = ?output, "Output");
9191
output
9292
}
@@ -131,10 +131,7 @@ pub fn generate_tunnel_args(svc: &Service) -> Result<Vec<String>, ReconcileError
131131
// The target port is what we expose externally and what the backend listens on
132132
let target_port = get_target_port(p);
133133
let protocol = get_protocol_suffix(p);
134-
format!(
135-
"{}:{}:{}:{}{}",
136-
target_ip, target_port, cluster_ip, target_port, protocol
137-
)
134+
format!("{target_ip}:{target_port}:{cluster_ip}:{target_port}{protocol}")
138135
})
139136
.collect();
140137

@@ -286,10 +283,10 @@ pub async fn create_owned_deployment(
286283

287284
Ok(Deployment {
288285
metadata: ObjectMeta {
289-
name: Some(format!("chisel-{}", service_name)),
286+
name: Some(format!("chisel-{service_name}")),
290287
owner_references: Some(vec![oref]),
291288
// namespace: exit_node.metadata.namespace.clone(),
292-
..ObjectMeta::default()
289+
..Default::default()
293290
},
294291
spec: Some(DeploymentSpec {
295292
template: create_pod_template(source, exit_node).await?,

0 commit comments

Comments
 (0)