refactor: Rust 1.82 linting
This commit is contained in:
+6
-12
@@ -704,20 +704,14 @@ impl AppData {
|
||||
// Should probably find a refactor here somewhere
|
||||
for container in [&self.containers.items, &self.hidden_containers] {
|
||||
for container in container {
|
||||
let cpu_count = count(
|
||||
&container
|
||||
.cpu_stats
|
||||
.back()
|
||||
.unwrap_or(&CpuStats::default())
|
||||
.to_string(),
|
||||
let cpu_count = container.cpu_stats.back().map_or_else(
|
||||
|| count(&CpuStats::default().to_string()),
|
||||
|i| count(&i.to_string()),
|
||||
);
|
||||
|
||||
let mem_current_count = count(
|
||||
&container
|
||||
.mem_stats
|
||||
.back()
|
||||
.unwrap_or(&ByteStats::default())
|
||||
.to_string(),
|
||||
let mem_current_count = container.mem_stats.back().map_or_else(
|
||||
|| count(&ByteStats::default().to_string()),
|
||||
|i| count(&i.to_string()),
|
||||
);
|
||||
|
||||
columns.cpu.1 = columns.cpu.1.max(cpu_count);
|
||||
|
||||
@@ -170,7 +170,7 @@ fn format_containers<'a>(i: &ContainerItem, widths: &Columns) -> Line<'a> {
|
||||
Span::styled(
|
||||
format!(
|
||||
"{:>width$}{MARGIN}",
|
||||
i.cpu_stats.back().unwrap_or(&CpuStats::default()),
|
||||
i.cpu_stats.back().map_or_else(CpuStats::default, |f| *f),
|
||||
width = &widths.cpu.1.into()
|
||||
),
|
||||
state_style,
|
||||
@@ -178,7 +178,7 @@ fn format_containers<'a>(i: &ContainerItem, widths: &Columns) -> Line<'a> {
|
||||
Span::styled(
|
||||
format!(
|
||||
"{:>width_current$} / {:>width_limit$}{MARGIN}",
|
||||
i.mem_stats.back().unwrap_or(&ByteStats::default()),
|
||||
i.mem_stats.back().map_or_else(ByteStats::default, |f| *f),
|
||||
i.mem_limit,
|
||||
width_current = &widths.mem.1.into(),
|
||||
width_limit = &widths.mem.2.into()
|
||||
|
||||
Reference in New Issue
Block a user