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