From 8d48f9cdae65116145535d730ca129b4ed880819 Mon Sep 17 00:00:00 2001 From: Xiaobo Liu Date: Sat, 18 Oct 2025 23:04:40 +0800 Subject: [PATCH] gpui: Simplify tab group lookup logic in SystemWindowTabController (#40466) Refactor the find_tab_group method to use the question mark operator for cleaner error handling, replacing the explicit if-else pattern with a more concise chained approach. Release Notes: - N/A Signed-off-by: Xiaobo Liu --- crates/gpui/src/app.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 07ff04e32abc19dbe681ab6214d06469fe7917ff..789652b331cd64f0d5400830fa19e5e50fc05b50 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -344,13 +344,9 @@ impl SystemWindowTabController { let tab_group = self .tab_groups .iter() - .find_map(|(group, tabs)| tabs.iter().find(|tab| tab.id == id).map(|_| *group)); + .find_map(|(group, tabs)| tabs.iter().find(|tab| tab.id == id).map(|_| *group))?; - if let Some(tab_group) = tab_group { - self.tab_groups.get(&tab_group) - } else { - None - } + self.tab_groups.get(&tab_group) } /// Initialize the visibility of the system window tab controller.