From a9a07b38052a6d6ac2915aa4a6eb3948e4553e56 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 24 Jun 2024 14:55:43 -0700 Subject: [PATCH] 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 --- src/ui/global_popup.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ui/global_popup.rs b/src/ui/global_popup.rs index 25a8d83d..ff1af8e9 100644 --- a/src/ui/global_popup.rs +++ b/src/ui/global_popup.rs @@ -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));