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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user