diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-22 08:23:40 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-18 14:46:54 +0200 |
commit | a09d3389533620a65cdaf33ed0b54865e9306d9c (patch) | |
tree | c9ccd6e339d93e1eed311f29fcbe5e00d5f81d01 | |
parent | 2d293a6ff0dedce3f7c663566fe018dd5c52433b (diff) |
Fix clippy in tedge_agent: Remove let-unit-value
This patch fixes `clippy::let_unit_value`.
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | crates/core/tedge_agent/src/agent.rs | 40 | ||||
-rw-r--r-- | crates/core/tedge_agent/src/restart_operation_handler.rs | 2 | ||||
-rw-r--r-- | crates/core/tedge_agent/src/state.rs | 4 |
3 files changed, 22 insertions, 24 deletions
diff --git a/crates/core/tedge_agent/src/agent.rs b/crates/core/tedge_agent/src/agent.rs index d4d723c8..d0e74194 100644 --- a/crates/core/tedge_agent/src/agent.rs +++ b/crates/core/tedge_agent/src/agent.rs @@ -276,7 +276,7 @@ impl SmAgent { } }); - let () = self.process_pending_operation(&mut mqtt.published).await?; + self.process_pending_operation(&mut mqtt.published).await?; while let Err(error) = self .process_subscribed_messages(&mut mqtt.received, &mut mqtt.published, &plugins) @@ -316,8 +316,8 @@ impl SmAgent { } topic if topic == &self.config.request_topic_update => { - let () = plugins.lock().await.load()?; - let () = plugins + plugins.lock().await.load()?; + plugins .lock() .await .update_default(&get_default_plugin(&self.config.config_location)?)?; @@ -348,7 +348,7 @@ impl SmAgent { self.persistance_store.clear().await?; let status = OperationStatus::Failed; let response = RestartOperationResponse::new(&request).with_status(status); - let () = responses + responses .publish(Message::new( &self.config.response_topic_restart, response.to_bytes()?, @@ -373,8 +373,7 @@ impl SmAgent { ) -> Result<(), AgentError> { let request = match SoftwareListRequest::from_slice(message.payload_bytes()) { Ok(request) => { - let () = self - .persistance_store + self.persistance_store .store(&State { operation_id: Some(request.id.clone()), operation: Some(StateStatus::Software(SoftwareOperationVariants::List)), @@ -386,7 +385,7 @@ impl SmAgent { Err(error) => { debug!("Parsing error: {}", error); - let () = responses + responses .publish(Message::new( &self.config.errors_topic, format!("{}", error), @@ -401,7 +400,7 @@ impl SmAgent { }; let mut executing_response = SoftwareListResponse::new(&request); - let () = responses + responses .publish(Message::new( &self.config.response_topic_list, executing_response.to_bytes()?, @@ -421,7 +420,7 @@ impl SmAgent { } }; - let () = responses + responses .publish(Message::new(response_topic, response.to_bytes()?)) .await?; @@ -452,7 +451,7 @@ impl SmAgent { Err(error) => { error!("Parsing error: {}", error); - let () = responses + responses .publish(Message::new( &self.config.errors_topic, format!("{}", error), @@ -467,7 +466,7 @@ impl SmAgent { }; let mut executing_response = SoftwareUpdateResponse::new(&request); - let () = responses + responses .publish(Message::new(response_topic, executing_response.to_bytes()?)) .await?; @@ -490,7 +489,7 @@ impl SmAgent { } }; - let () = responses + responses .publish(Message::new(response_topic, response.to_bytes()?)) .await?; @@ -506,8 +505,7 @@ impl SmAgent { ) -> Result<RestartOperationRequest, AgentError> { let request = match RestartOperationRequest::from_slice(message.payload_bytes()) { Ok(request) => { - let () = self - .persistance_store + self.persistance_store .store(&State { operation_id: Some(request.id.clone()), operation: Some(StateStatus::Restart(RestartOperationStatus::Restarting)), @@ -518,7 +516,7 @@ impl SmAgent { Err(error) => { error!("Parsing error: {}", error); - let () = responses + responses .publish(Message::new( &self.config.errors_topic, format!("{}", error), @@ -545,10 +543,10 @@ impl SmAgent { // update status to executing. let executing_response = RestartOperationResponse::new(&RestartOperationRequest::default()); - let () = responses + responses .publish(Message::new(topic, executing_response.to_bytes()?)) .await?; - let () = restart_operation::create_slash_run_file(&self.config.run_dir)?; + restart_operation::create_slash_run_file(&self.config.run_dir)?; let command_vec = get_restart_operation_commands(); for mut command in command_vec { @@ -614,7 +612,7 @@ impl SmAgent { let response = SoftwareRequestResponse::new(&id, status); - let () = responses + responses .publish(Message::new(topic, response.to_bytes()?)) .await?; } @@ -685,7 +683,7 @@ mod tests { let (_output, mut output_stream) = mqtt_tests::output_stream(); let response_topic_restart = Topic::new(RestartOperationResponse::topic_name()).expect("Invalid topic"); - let () = agent + agent .handle_restart_operation(&mut output_stream, &response_topic_restart) .await?; assert!(std::path::Path::new( @@ -761,7 +759,7 @@ mod tests { ) .unwrap(), )); - let () = agent + agent .handle_software_list_request( &mut output_sink, plugins, @@ -805,7 +803,7 @@ mod tests { ) .unwrap(), )); - let () = agent + agent .process_subscribed_messages(&mut requests, &mut response_sink, &plugins) .await .unwrap(); diff --git a/crates/core/tedge_agent/src/restart_operation_handler.rs b/crates/core/tedge_agent/src/restart_operation_handler.rs index 29342cb0..e6db967f 100644 --- a/crates/core/tedge_agent/src/restart_operation_handler.rs +++ b/crates/core/tedge_agent/src/restart_operation_handler.rs @@ -12,7 +12,7 @@ pub mod restart_operation { /// /// # Example /// ``` - /// let () = RestartOperationHelper::create_slash_run_file()?; + /// RestartOperationHelper::create_slash_run_file()?; /// ``` pub fn create_slash_run_file(run_dir: &Path) -> Result<(), AgentError> { let path = &run_dir.join(SLASH_RUN_PATH_TEDGE_AGENT_RESTART); diff --git a/crates/core/tedge_agent/src/state.rs b/crates/core/tedge_agent/src/state.rs index 36b378dd..7f482822 100644 --- a/crates/core/tedge_agent/src/state.rs +++ b/crates/core/tedge_agent/src/state.rs @@ -41,7 +41,7 @@ impl StateRepository for AgentStateRepository { // Create in path given through `config-dir` or `/etc/tedge` directory in case it does not exist yet if !self.state_repo_root.exists() { - let () = fs::create_dir(&self.state_repo_root).await?; + fs::create_dir(&self.state_repo_root).await?; } let mut temppath = self.state_repo_path.clone(); @@ -58,7 +58,7 @@ impl StateRepository for AgentStateRepository { operation_id: None, operation: None, }; - let () = self.store(&state).await?; + self.store(&state).await?; Ok(state) } |