summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-07-22 08:23:42 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-08-18 14:50:54 +0200
commit9e2e58976df61dbba79d3e24ecb0c07bfe6969e1 (patch)
tree0febafbb54ee05eabec53486b34d5c61506c968d
parent2e954163bb34c4695fad2e3d1d7e76313dfd0c76 (diff)
Fix clippy in c8y_log_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_log_plugin/src/config.rs2
-rw-r--r--plugins/c8y_log_plugin/src/logfile_request.rs10
-rw-r--r--plugins/c8y_log_plugin/src/main.rs14
3 files changed, 13 insertions, 13 deletions
diff --git a/plugins/c8y_log_plugin/src/config.rs b/plugins/c8y_log_plugin/src/config.rs
index 8747bdf6..0bc9292b 100644
--- a/plugins/c8y_log_plugin/src/config.rs
+++ b/plugins/c8y_log_plugin/src/config.rs
@@ -74,7 +74,7 @@ impl LogPluginConfig {
// 118,typeA,typeB,...
fn to_smartrest_payload(&self) -> String {
let mut config_types = self.get_all_file_types();
- let () = config_types.sort();
+ config_types.sort();
let supported_config_types = config_types.join(",");
format!("118,{supported_config_types}")
}
diff --git a/plugins/c8y_log_plugin/src/logfile_request.rs b/plugins/c8y_log_plugin/src/logfile_request.rs
index 750f2acd..f2a1ef51 100644
--- a/plugins/c8y_log_plugin/src/logfile_request.rs
+++ b/plugins/c8y_log_plugin/src/logfile_request.rs
@@ -217,7 +217,7 @@ async fn execute_logfile_request_operation(
http_client: &mut JwtAuthHttpProxy,
) -> Result<(), anyhow::Error> {
let executing = LogfileRequest::executing()?;
- let () = mqtt_client.published.send(executing).await?;
+ mqtt_client.published.send(executing).await?;
let log_content = new_read_logs(smartrest_request, plugin_config)?;
@@ -226,7 +226,7 @@ async fn execute_logfile_request_operation(
.await?;
let successful = LogfileRequest::successful(Some(upload_event_url))?;
- let () = mqtt_client.published.send(successful).await?;
+ mqtt_client.published.send(successful).await?;
info!("Log request processed.");
Ok(())
@@ -249,7 +249,7 @@ pub async fn handle_logfile_request_operation(
Err(error) => {
let error_message = format!("Handling of operation failed with {}", error);
let failed_msg = LogfileRequest::failed(error_message)?;
- let () = mqtt_client.published.send(failed_msg).await?;
+ mqtt_client.published.send(failed_msg).await?;
Err(error)
}
}
@@ -438,7 +438,7 @@ mod tests {
let data = "this is the first line.\nthis is the second line.\nthis is the third line.\nthis is the forth line.\nthis is the fifth line.";
- let () = log_file.write_all(data.as_bytes()).unwrap();
+ log_file.write_all(data.as_bytes()).unwrap();
let line_counter = 0;
let max_lines = 4;
@@ -491,7 +491,7 @@ mod tests {
let data = &format!("this is the first line of {file_name}.\nthis is the second line of {file_name}.\nthis is the third line of {file_name}.\nthis is the forth line of {file_name}.\nthis is the fifth line of {file_name}.");
- let () = log_file.write_all(data.as_bytes()).unwrap();
+ log_file.write_all(data.as_bytes()).unwrap();
let new_mtime = FileTime::from_unix_time(m_time, 0);
set_file_mtime(file_path, new_mtime).unwrap();
diff --git a/plugins/c8y_log_plugin/src/main.rs b/plugins/c8y_log_plugin/src/main.rs
index b5a7799e..169e00fc 100644
--- a/plugins/c8y_log_plugin/src/main.rs
+++ b/plugins/c8y_log_plugin/src/main.rs
@@ -79,7 +79,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)
}
@@ -93,7 +93,7 @@ async fn run(
let health_check_topics = health_check_topics("c8y-log-plugin");
let config_file_path = config_dir.join(config_file_name);
- let () = handle_dynamic_log_type_update(&plugin_config, mqtt_client).await?;
+ handle_dynamic_log_type_update(&plugin_config, mqtt_client).await?;
let fs_notification_stream = fs_notify_stream(&[(
config_dir,
@@ -116,7 +116,7 @@ async fn run(
match mask {
FileEvent::Created | FileEvent::Deleted | FileEvent::Modified => {
plugin_config = read_log_config(&config_file_path);
- let () = handle_dynamic_log_type_update(&plugin_config, mqtt_client).await?;
+ handle_dynamic_log_type_update(&plugin_config, mqtt_client).await?;
}
}
}
@@ -134,7 +134,7 @@ pub async fn process_mqtt_message(
) -> Result<(), anyhow::Error> {
if is_c8y_bridge_up(&message) {
let plugin_config = read_log_config(config_file);
- let () = handle_dynamic_log_type_update(&plugin_config, mqtt_client).await?;
+ handle_dynamic_log_type_update(&plugin_config, mqtt_client).await?;
} else if health_check_topics.accept(&message) {
send_health_status(&mut mqtt_client.published, "c8y-log-plugin").await;
} else if let Ok(payload) = message.payload_str() {
@@ -192,7 +192,7 @@ async fn main() -> Result<(), anyhow::Error> {
let logs_dir = PathBuf::from(logs_dir.to_string());
if config_plugin_opt.init {
- let () = init(&config_plugin_opt.config_dir, &logs_dir)?;
+ init(&config_plugin_opt.config_dir, &logs_dir)?;
return Ok(());
}
@@ -200,7 +200,7 @@ async fn main() -> Result<(), anyhow::Error> {
let mut mqtt_client = create_mqtt_client(&tedge_config).await?;
let mut http_client = create_http_client(&tedge_config).await?;
- let () = run(
+ run(
&config_dir,
DEFAULT_PLUGIN_CONFIG_FILE,
&mut mqtt_client,
@@ -212,7 +212,7 @@ async fn main() -> Result<(), anyhow::Error> {
fn init(config_dir: &Path, logs_dir: &Path) -> Result<(), anyhow::Error> {
info!("Creating supported operation files");
- let () = create_init_logs_directories_and_files(config_dir, logs_dir)?;
+ create_init_logs_directories_and_files(config_dir, logs_dir)?;
Ok(())
}