Skip to content

Commit

Permalink
Remove unnecessary clones
Browse files Browse the repository at this point in the history
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
  • Loading branch information
jarhodes314 committed Nov 21, 2023
1 parent ac55204 commit 6ce986f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions crates/core/tedge_agent/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl Agent {
}

#[instrument(skip(self), name = "sm-agent")]
pub async fn start(&mut self, v1: bool) -> Result<(), anyhow::Error> {
pub async fn start(self, v1: bool) -> Result<(), anyhow::Error> {
info!("Starting tedge agent");
self.init()?;

Expand All @@ -217,20 +217,18 @@ impl Agent {
// File transfer server actor
let file_transfer_server_builder = FileTransferServerBuilder::try_bind(
self.config.http_socket_addr,
self.config.http_config.clone(),
self.config.http_config,
)
.await?;

// Restart actor
let mut restart_actor_builder =
RestartManagerBuilder::new(self.config.restart_config.clone());
let mut restart_actor_builder = RestartManagerBuilder::new(self.config.restart_config);

// Mqtt actor
let mut mqtt_actor_builder = MqttActorBuilder::new(self.config.mqtt_config.clone());

// Software update actor
let mut software_update_builder =
SoftwareManagerBuilder::new(self.config.sw_update_config.clone());
let mut software_update_builder = SoftwareManagerBuilder::new(self.config.sw_update_config);

// Converter actor
let converter_actor_builder = TedgeOperationConverterBuilder::new(
Expand Down Expand Up @@ -287,7 +285,7 @@ impl Agent {
// Instantiate log manager actor
let log_manager_config = LogManagerConfig::from_options(LogManagerOptions {
config_dir: self.config.config_dir.clone().into(),
tmp_dir: self.config.config_dir.clone().into(),
tmp_dir: self.config.config_dir.into(),
mqtt_schema,
mqtt_device_topic_id: self.config.mqtt_device_topic_id.clone(),
})?;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/tedge_agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub async fn run(agent_opt: AgentOpt, v1: bool) -> Result<(), anyhow::Error> {

let init = agent_opt.init;

let mut agent = agent::Agent::try_new(
let agent = agent::Agent::try_new(
"tedge-agent",
AgentConfig::from_config_and_cliopts(&tedge_config_location, agent_opt)?,
)?;
Expand Down

0 comments on commit 6ce986f

Please sign in to comment.