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 <cppcoffee@gmail.com>
This commit is contained in:
Xiaobo Liu
2025-10-18 15:04:40 +00:00
committed by GitHub
parent 41994452f2
commit 8d48f9cdae
+2 -6
View File
@@ -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.