Skip to content

Commit

Permalink
refactor: use map instead of explicit if let
Browse files Browse the repository at this point in the history
We also use last instead of first, because the last route should be the
active one.

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Jun 24, 2024
1 parent 677c217 commit a9a07b3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/ui/global_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit a9a07b3

Please sign in to comment.