From 751d997a3dac823e144ae62e6c1455676e50ddb8 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:27:47 +0000 Subject: [PATCH] chore: Rust 1.83 linting --- src/app_data/mod.rs | 8 -------- src/docker_data/mod.rs | 7 ++++--- src/ui/draw_blocks.rs | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index 215a523..2907570 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -160,7 +160,6 @@ impl AppData { } /// Filter related methods - /// Get the current filter term pub const fn get_filter_term(&self) -> Option<&String> { self.filter.term.as_ref() @@ -280,7 +279,6 @@ impl AppData { } /// Container sort related methods - /// Change the sorted order, also set the selected container state to match new order fn set_sorted(&mut self, x: Option<(Header, SortedOrder)>) { self.sorted_by = x; @@ -390,7 +388,6 @@ impl AppData { } /// Container state methods - /// Get the total number of none "hidden" containers pub fn get_container_len(&self) -> usize { self.containers.items.len() @@ -530,7 +527,6 @@ impl AppData { } /// Selected DockerCommand methods - /// Get the current selected docker command /// So know which command to execute pub fn selected_docker_controls(&self) -> Option { @@ -585,7 +581,6 @@ impl AppData { } /// Logs related methods - /// Get the title for log panel for selected container, will be either /// 1) "logs x/x - container_name - container_image" /// 2) "logs - container_name - container_image" when no logs found @@ -650,7 +645,6 @@ impl AppData { } /// Chart data related methods - /// Get mutable Option of the currently selected container chart data pub fn get_chart_data(&mut self) -> Option<(CpuTuple, MemTuple)> { self.containers @@ -661,7 +655,6 @@ impl AppData { } /// Error related methods - /// Get single app_state error pub const fn get_error(&self) -> Option { self.error @@ -726,7 +719,6 @@ impl AppData { } /// Update related methods - /// Get mutable reference to a container in the containers vec & the hidden_containers vec fn get_any_container_by_id(&mut self, id: &ContainerId) -> Option<&mut ContainerItem> { if self.get_hidden_container_by_id(id).is_some() { diff --git a/src/docker_data/mod.rs b/src/docker_data/mod.rs index d3dac77..1188b84 100644 --- a/src/docker_data/mod.rs +++ b/src/docker_data/mod.rs @@ -277,15 +277,16 @@ impl DockerData { } /// Update all logs, spawn each container into own tokio::spawn thread - fn init_all_logs(&self, all_ids: &[(State, ContainerId)], init: &Option>) { + fn init_all_logs(&self, all_ids: &[(State, ContainerId)], init: Option<&Arc>) { for (_, id) in all_ids { + // let init = init.map(|i|Arc::clone(i)); self.spawns.lock().insert( SpawnId::Log(id.clone()), tokio::spawn(Self::update_log( Arc::clone(&self.app_data), Arc::clone(&self.docker), id.clone(), - init.clone(), + init.map(Arc::clone), 0, Arc::clone(&self.spawns), )), @@ -303,7 +304,7 @@ impl DockerData { self.update_all_container_stats(&all_ids); let init = Arc::new(AtomicUsize::new(0)); - self.init_all_logs(&all_ids, &Some(Arc::clone(&init))); + self.init_all_logs(&all_ids, Some(&init)); while init.load(std::sync::atomic::Ordering::SeqCst) != all_ids.len() { self.app_data.lock().sort_containers(); diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index 23b8205..395bf31 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -1000,7 +1000,7 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option) { let area = popup(lines, max_line_width, f.area(), BoxLocation::MiddleCentre); - f.render_widget(Clear, area); + f.render_widget(Clear, area); f.render_widget(paragraph, area); }