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:
@@ -20,12 +20,8 @@ impl DesktopGlobalPopup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let rect = ui.ctx().screen_rect().shrink(MARGIN);
|
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'
|
let title = routes.last().map(|r| r.title());
|
||||||
Some(first.title())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let app_ctx = Rc::new(RefCell::new(app));
|
let app_ctx = Rc::new(RefCell::new(app));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user