From 90172b16a46aeecdb2aaddc21af92e22c3727232 Mon Sep 17 00:00:00 2001 From: Sebastian YEPES Date: Thu, 29 Jun 2023 10:20:09 +0200 Subject: [PATCH] Fix logic --- .github/workflows/rust.yml | 2 +- src/sio/client.rs | 6 ++---- src/sio/metrics.rs | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 707bbc9..1ac0b1c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -73,4 +73,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --all-features -- -D warnings + args: --all-features -- -D warnings -A clippy::redundant-clone diff --git a/src/sio/client.rs b/src/sio/client.rs index 6910746..8b00de8 100644 --- a/src/sio/client.rs +++ b/src/sio/client.rs @@ -296,13 +296,11 @@ impl<'a> ClientInfo<'a> { let clu_name = match instances.get("System").and_then(|o| o.as_object().and_then(|j| j.get("name")).map(|s| s.to_string().replace('"', ""))) { None => { warn!("clu_name Not found using clu_id as name"); - None + clu_id.to_string() }, - Some(s) => Some(s), + Some(s) => s, }; - let clu_name = if let Some(id) = clu_name { id } else { clu_name.unwrap() }; - // System { let mut label: HashMap<&'static str, String> = HashMap::new(); diff --git a/src/sio/metrics.rs b/src/sio/metrics.rs index 7353746..5acc636 100644 --- a/src/sio/metrics.rs +++ b/src/sio/metrics.rs @@ -51,11 +51,10 @@ fn convert_states(instances: &Map, relations: &HashMa let clu_name = match instances.get("System").and_then(|o| o.as_object().and_then(|j| j.get("name")).map(|s| s.to_string().replace('"', ""))) { None => { warn!("clu_name Not found using clu_id as name"); - None + clu_id.to_string() }, - Some(s) => Some(s), + Some(s) => s, }; - let clu_name = if let Some(id) = clu_name { id } else { clu_name.unwrap() }; // Sdc for sdc in instances.get("sdcList").and_then(|v| v.as_array()).unwrap_or_else(|| {