refactor: use map instead of explicit if let

We also use last instead of first, because the last route should be the
active one.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-06-24 14:55:43 -07:00
parent 677c217ecd
commit a9a07b3805

View File

@@ -20,12 +20,8 @@ impl DesktopGlobalPopup {
}
let rect = ui.ctx().screen_rect().shrink(MARGIN);
let title = if let Some(first) = routes.first() {
// TODO(kernelkind): not a great way of getting the title of the routes 'grouping'
Some(first.title())
} else {
None
};
let title = routes.last().map(|r| r.title());
let app_ctx = Rc::new(RefCell::new(app));