diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-22 08:23:42 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-18 14:48:45 +0200 |
commit | 2e954163bb34c4695fad2e3d1d7e76313dfd0c76 (patch) | |
tree | 5558a48d09a5cc57907660c1398d40090b577a85 | |
parent | 193ccc20a7811af35bbe29c18d8dee44b1655f2d (diff) |
Fix clippy in c8y_configuration_plugin: Remove let-unit-value
This patch fixes `clippy::let_unit_value`.
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | plugins/c8y_configuration_plugin/src/config.rs | 2 | ||||
-rw-r--r-- | plugins/c8y_configuration_plugin/src/download.rs | 16 | ||||
-rw-r--r-- | plugins/c8y_configuration_plugin/src/main.rs | 8 | ||||
-rw-r--r-- | plugins/c8y_configuration_plugin/src/upload.rs | 6 |
4 files changed, 16 insertions, 16 deletions
diff --git a/plugins/c8y_configuration_plugin/src/config.rs b/plugins/c8y_configuration_plugin/src/config.rs index d738bda2..abf00bc2 100644 --- a/plugins/c8y_configuration_plugin/src/config.rs +++ b/plugins/c8y_configuration_plugin/src/config.rs @@ -173,7 +173,7 @@ impl PluginConfig { fn to_smartrest_payload(&self) -> String { let mut config_types = self.get_all_file_types(); // Sort because hashset doesn't guarantee the order - let () = config_types.sort(); + config_types.sort(); let supported_config_types = config_types.join(","); format!("119,{supported_config_types}") } diff --git a/plugins/c8y_configuration_plugin/src/download.rs b/plugins/c8y_configuration_plugin/src/download.rs index 807d0cdb..530139fe 100644 --- a/plugins/c8y_configuration_plugin/src/download.rs +++ b/plugins/c8y_configuration_plugin/src/download.rs @@ -26,7 +26,7 @@ pub async fn handle_config_download_request( http_client: &mut impl C8YHttpProxy, ) -> Result<(), anyhow::Error> { let executing_message = DownloadConfigFileStatusMessage::executing()?; - let () = mqtt_client.published.send(executing_message).await?; + mqtt_client.published.send(executing_message).await?; let target_config_type = smartrest_request.config_type.clone(); let mut target_file_entry = FileEntry::default(); @@ -53,18 +53,18 @@ pub async fn handle_config_download_request( info!("The configuration download for '{target_config_type}' is successful."); let successful_message = DownloadConfigFileStatusMessage::successful(None)?; - let () = mqtt_client.published.send(successful_message).await?; + mqtt_client.published.send(successful_message).await?; let notification_message = get_file_change_notification_message(&target_file_entry.path, &target_config_type); - let () = mqtt_client.published.send(notification_message).await?; + mqtt_client.published.send(notification_message).await?; Ok(()) } Err(err) => { error!("The configuration download for '{target_config_type}' failed.",); let failed_message = DownloadConfigFileStatusMessage::failed(err.to_string())?; - let () = mqtt_client.published.send(failed_message).await?; + mqtt_client.published.send(failed_message).await?; Err(err) } } @@ -82,7 +82,7 @@ async fn download_config_file( ConfigDownloadRequest::try_new(download_url, file_path, tmp_dir, file_permissions)?; // Confirm that the file has write access before any http request attempt - let () = config_download_request.has_write_access()?; + config_download_request.has_write_access()?; // If the provided url is c8y, add auth if http_client.url_is_in_my_tenant_domain(config_download_request.download_info.url()) { @@ -92,12 +92,12 @@ async fn download_config_file( // Download a file to tmp dir let downloader = config_download_request.create_downloader(); - let () = downloader + downloader .download(&config_download_request.download_info) .await?; // Move the downloaded file to the final destination - let () = config_download_request.move_file()?; + config_download_request.move_file()?; Ok(()) } @@ -190,7 +190,7 @@ impl ConfigDownloadRequest { self.file_permissions.clone() }; - let () = file_permissions.apply(&self.file_path)?; + file_permissions.apply(&self.file_path)?; Ok(()) } diff --git a/plugins/c8y_configuration_plugin/src/main.rs b/plugins/c8y_configuration_plugin/src/main.rs index 2e1f620e..98de9c48 100644 --- a/plugins/c8y_configuration_plugin/src/main.rs +++ b/plugins/c8y_configuration_plugin/src/main.rs @@ -78,7 +78,7 @@ pub async fn create_http_client( tedge_config: &TEdgeConfig, ) -> Result<JwtAuthHttpProxy, anyhow::Error> { let mut http_proxy = JwtAuthHttpProxy::try_new(tedge_config).await?; - let () = http_proxy.init().await?; + http_proxy.init().await?; Ok(http_proxy) } @@ -127,14 +127,14 @@ async fn run( // Publish supported configuration types let msg = plugin_config.to_supported_config_types_message()?; debug!("Plugin init message: {:?}", msg); - let () = mqtt_client.published.send(msg).await?; + mqtt_client.published.send(msg).await?; // Get pending operations let msg = Message::new( &Topic::new_unchecked(C8yTopic::SmartRestResponse.as_str()), "500", ); - let () = mqtt_client.published.send(msg).await?; + mqtt_client.published.send(msg).await?; let fs_notification_stream = fs_notify_stream(&[( config_dir, @@ -250,7 +250,7 @@ async fn process_mqtt_message( fn init(cfg_dir: PathBuf) -> Result<(), anyhow::Error> { info!("Creating supported operation files"); - let () = create_operation_files(&cfg_dir)?; + create_operation_files(&cfg_dir)?; Ok(()) } diff --git a/plugins/c8y_configuration_plugin/src/upload.rs b/plugins/c8y_configuration_plugin/src/upload.rs index 957cbb9c..1b7da3ce 100644 --- a/plugins/c8y_configuration_plugin/src/upload.rs +++ b/plugins/c8y_configuration_plugin/src/upload.rs @@ -51,7 +51,7 @@ pub async fn handle_config_upload_request( ) -> Result<()> { // set config upload request to executing let msg = UploadConfigFileStatusMessage::executing()?; - let () = mqtt_client.published.send(msg).await?; + mqtt_client.published.send(msg).await?; let upload_result = { match plugin_config.get_file_entry_from_type(&config_upload_request.config_type) { @@ -76,13 +76,13 @@ pub async fn handle_config_upload_request( let successful_message = UploadConfigFileStatusMessage::successful(Some(upload_event_url))?; - let () = mqtt_client.published.send(successful_message).await?; + mqtt_client.published.send(successful_message).await?; } Err(err) => { error!("The configuration upload for '{target_config_type}' failed.",); let failed_message = UploadConfigFileStatusMessage::failed(err.to_string())?; - let () = mqtt_client.published.send(failed_message).await?; + mqtt_client.published.send(failed_message).await?; } } |