notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit a9a07b38052a6d6ac2915aa4a6eb3948e4553e56
parent 677c217ecdaa9d36b1f61a0127aae58d6c0b5944
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 24 Jun 2024 14:55:43 -0700

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>

Diffstat:
Msrc/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 @@ -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));