From eecd22274eb3baed62ffefa53be54d1768dc1c99 Mon Sep 17 00:00:00 2001 From: Didier Wenzek Date: Thu, 19 Dec 2024 17:15:35 +0100 Subject: [PATCH] fixup! fixup! Avoid returning String when callers expect &str --- crates/core/tedge_agent/src/operation_workflows/persist.rs | 2 +- crates/core/tedge_api/src/workflow/state.rs | 4 ++-- crates/core/tedge_api/src/workflow/supervisor.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/core/tedge_agent/src/operation_workflows/persist.rs b/crates/core/tedge_agent/src/operation_workflows/persist.rs index 14dfe88262..1ba0d02a52 100644 --- a/crates/core/tedge_agent/src/operation_workflows/persist.rs +++ b/crates/core/tedge_agent/src/operation_workflows/persist.rs @@ -275,7 +275,7 @@ impl WorkflowRepository { if let Err(err) = tokio::fs::copy(source.clone(), target.clone()).await { error!("Fail to persist a copy of {source} as {target}: {err}"); } else { - self.in_use_copies.insert(version.to_string(), 1); + self.in_use_copies.insert(version.to_owned(), 1); } } } diff --git a/crates/core/tedge_api/src/workflow/state.rs b/crates/core/tedge_api/src/workflow/state.rs index baacfa7544..5ecfba3d54 100644 --- a/crates/core/tedge_api/src/workflow/state.rs +++ b/crates/core/tedge_api/src/workflow/state.rs @@ -193,10 +193,10 @@ impl GenericCommandState { fn set_key_value(&mut self, key: &str, val: &str) { if let Some(o) = self.payload.as_object_mut() { - o.insert(key.to_string(), val.into()); + o.insert(key.into(), val.into()); } if key == STATUS { - self.status = val.to_string(); + self.status = val.to_owned(); } } diff --git a/crates/core/tedge_api/src/workflow/supervisor.rs b/crates/core/tedge_api/src/workflow/supervisor.rs index d381ec1bb1..3fc7265a6b 100644 --- a/crates/core/tedge_api/src/workflow/supervisor.rs +++ b/crates/core/tedge_api/src/workflow/supervisor.rs @@ -137,8 +137,8 @@ impl WorkflowSupervisor { /// Return the current version if any. pub fn use_current_version(&mut self, operation: &OperationName) -> Option { self.workflows - .get_mut(&operation.as_str().into()) - .map(WorkflowVersions::use_current_version)? + .get_mut(&operation.as_str().into())? + .use_current_version() .cloned() }