From 258ada731bae29df157f2cbaeb46c2dccf547704 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:29:09 +0000 Subject: [PATCH] chore: linting warns removed --- src/app_data/container_state.rs | 2 +- src/app_data/mod.rs | 12 ++++++------ src/main.rs | 4 ++-- src/ui/mod.rs | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/app_data/container_state.rs b/src/app_data/container_state.rs index 37b35fd..183186c 100644 --- a/src/app_data/container_state.rs +++ b/src/app_data/container_state.rs @@ -223,7 +223,7 @@ impl Ord for CpuStats { fn cmp(&self, other: &Self) -> Ordering { if self.value > other.value { Ordering::Greater - } else if self.value == other.value { + } else if (self.value - other.value).abs() < 0.01 { Ordering::Equal } else { Ordering::Less diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index da15bfe..39bc5ee 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -329,8 +329,8 @@ impl AppData { container.mem_limit )); - let net_rx_count = count(&container.rx.to_string()); - let net_tx_count = count(&container.tx.to_string()); + let rx_count = count(&container.rx.to_string()); + let tx_count = count(&container.tx.to_string()); let image_count = count(&container.image); let name_count = count(&container.name); let state_count = count(&container.state.to_string()); @@ -354,11 +354,11 @@ impl AppData { if status_count > output.status.1 { output.status.1 = status_count; }; - if net_rx_count > output.net_rx.1 { - output.net_rx.1 = net_rx_count; + if rx_count > output.net_rx.1 { + output.net_rx.1 = rx_count; }; - if net_tx_count > output.net_tx.1 { - output.net_tx.1 = net_tx_count; + if tx_count > output.net_tx.1 { + output.net_tx.1 = tx_count; }; } output diff --git a/src/main.rs b/src/main.rs index 12a74b9..b7fda0e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,8 +2,8 @@ #![warn(clippy::unused_async, clippy::unwrap_used, clippy::expect_used)] // Wanring - These are indeed pedantic // #![warn(clippy::pedantic)] -#![warn(clippy::nursery)] -#![allow(clippy::module_name_repetitions, clippy::doc_markdown)] +// #![warn(clippy::nursery)] +// #![allow(clippy::module_name_repetitions, clippy::doc_markdown)] // Only allow when debugging // #![allow(unused)] diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 55e3d50..6d59eaa 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -147,12 +147,12 @@ fn ui( gui_state: &Arc>, ) { // set max height for container section, needs +4 to deal with docker commands list and borders - let mut height = app_data.lock().get_container_len(); - if height < 12 { - height += 4; + let height = app_data.lock().get_container_len(); + let height = if height < 12 { + (height + 4) as u16 } else { - height = 12; - } + 12 + }; let column_widths = app_data.lock().get_width(); let has_containers = !app_data.lock().containers.items.is_empty();