From 846fb60131c87f33d7c3863f9d754976d13df457 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 30 May 2022 01:19:37 +0000 Subject: [PATCH] fix: docker data remove unwrap() use filter_map in update_containers iter, rather than map(i.unwrap()) --- src/app_data/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index c101a0e..a93c1da 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -99,9 +99,9 @@ impl AppData { self.error = Some(error); } - /// Find the if of the currently selected container - /// If any containers on system, will always return - /// Only returns None when no containers found + /// Find the if of the currently selected container. + /// If any containers on system, will always return a string. + /// Only returns None when no containers found. pub fn get_selected_container_id(&self) -> Option { let mut output = None; if let Some(index) = self.containers.state.selected() { @@ -296,7 +296,7 @@ impl AppData { for (index, id) in all_ids.iter().enumerate() { if !containers .iter() - .map(|i| i.id.as_ref().unwrap()) + .filter_map(|i| i.id.as_ref()) .any(|x| x == id) { // If removed container is currently selected, then change selected to previous