chore: Rust 1.83 linting

This commit is contained in:
Jack Wills
2024-11-28 14:27:47 +00:00
parent 5ee48d5708
commit 751d997a3d
3 changed files with 5 additions and 12 deletions
-8
View File
@@ -160,7 +160,6 @@ impl AppData {
} }
/// Filter related methods /// Filter related methods
/// Get the current filter term /// Get the current filter term
pub const fn get_filter_term(&self) -> Option<&String> { pub const fn get_filter_term(&self) -> Option<&String> {
self.filter.term.as_ref() self.filter.term.as_ref()
@@ -280,7 +279,6 @@ impl AppData {
} }
/// Container sort related methods /// Container sort related methods
/// Change the sorted order, also set the selected container state to match new order /// Change the sorted order, also set the selected container state to match new order
fn set_sorted(&mut self, x: Option<(Header, SortedOrder)>) { fn set_sorted(&mut self, x: Option<(Header, SortedOrder)>) {
self.sorted_by = x; self.sorted_by = x;
@@ -390,7 +388,6 @@ impl AppData {
} }
/// Container state methods /// Container state methods
/// Get the total number of none "hidden" containers /// Get the total number of none "hidden" containers
pub fn get_container_len(&self) -> usize { pub fn get_container_len(&self) -> usize {
self.containers.items.len() self.containers.items.len()
@@ -530,7 +527,6 @@ impl AppData {
} }
/// Selected DockerCommand methods /// Selected DockerCommand methods
/// Get the current selected docker command /// Get the current selected docker command
/// So know which command to execute /// So know which command to execute
pub fn selected_docker_controls(&self) -> Option<DockerCommand> { pub fn selected_docker_controls(&self) -> Option<DockerCommand> {
@@ -585,7 +581,6 @@ impl AppData {
} }
/// Logs related methods /// Logs related methods
/// Get the title for log panel for selected container, will be either /// Get the title for log panel for selected container, will be either
/// 1) "logs x/x - container_name - container_image" /// 1) "logs x/x - container_name - container_image"
/// 2) "logs - container_name - container_image" when no logs found /// 2) "logs - container_name - container_image" when no logs found
@@ -650,7 +645,6 @@ impl AppData {
} }
/// Chart data related methods /// Chart data related methods
/// Get mutable Option of the currently selected container chart data /// Get mutable Option of the currently selected container chart data
pub fn get_chart_data(&mut self) -> Option<(CpuTuple, MemTuple)> { pub fn get_chart_data(&mut self) -> Option<(CpuTuple, MemTuple)> {
self.containers self.containers
@@ -661,7 +655,6 @@ impl AppData {
} }
/// Error related methods /// Error related methods
/// Get single app_state error /// Get single app_state error
pub const fn get_error(&self) -> Option<AppError> { pub const fn get_error(&self) -> Option<AppError> {
self.error self.error
@@ -726,7 +719,6 @@ impl AppData {
} }
/// Update related methods /// Update related methods
/// Get mutable reference to a container in the containers vec & the hidden_containers vec /// 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> { fn get_any_container_by_id(&mut self, id: &ContainerId) -> Option<&mut ContainerItem> {
if self.get_hidden_container_by_id(id).is_some() { if self.get_hidden_container_by_id(id).is_some() {
+4 -3
View File
@@ -277,15 +277,16 @@ impl DockerData {
} }
/// Update all logs, spawn each container into own tokio::spawn thread /// Update all logs, spawn each container into own tokio::spawn thread
fn init_all_logs(&self, all_ids: &[(State, ContainerId)], init: &Option<Arc<AtomicUsize>>) { fn init_all_logs(&self, all_ids: &[(State, ContainerId)], init: Option<&Arc<AtomicUsize>>) {
for (_, id) in all_ids { for (_, id) in all_ids {
// let init = init.map(|i|Arc::clone(i));
self.spawns.lock().insert( self.spawns.lock().insert(
SpawnId::Log(id.clone()), SpawnId::Log(id.clone()),
tokio::spawn(Self::update_log( tokio::spawn(Self::update_log(
Arc::clone(&self.app_data), Arc::clone(&self.app_data),
Arc::clone(&self.docker), Arc::clone(&self.docker),
id.clone(), id.clone(),
init.clone(), init.map(Arc::clone),
0, 0,
Arc::clone(&self.spawns), Arc::clone(&self.spawns),
)), )),
@@ -303,7 +304,7 @@ impl DockerData {
self.update_all_container_stats(&all_ids); self.update_all_container_stats(&all_ids);
let init = Arc::new(AtomicUsize::new(0)); 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() { while init.load(std::sync::atomic::Ordering::SeqCst) != all_ids.len() {
self.app_data.lock().sort_containers(); self.app_data.lock().sort_containers();
+1 -1
View File
@@ -1000,7 +1000,7 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option<u8>) {
let area = popup(lines, max_line_width, f.area(), BoxLocation::MiddleCentre); 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); f.render_widget(paragraph, area);
} }