Skip to content

Commit

Permalink
Minor code improvement
Browse files Browse the repository at this point in the history
Better use of rust expression pattern matching.
  • Loading branch information
kingofpayne authored and agrojean-ledger committed Nov 27, 2023
1 parent 4548218 commit d17979b
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/app_ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ fn ui_about_menu(comm: &mut Comm) -> Event<ApduHeader> {
loop {
match MultiPageMenu::new(comm, &pages).show() {
EventOrPageIndex::Event(e) => return e,
i => {
if let EventOrPageIndex::Index(1) = i {
return ui_menu_main(comm);
}
}
EventOrPageIndex::Index(1) => return ui_menu_main(comm),
EventOrPageIndex::Index(_) => (),
}
}
}
Expand All @@ -50,11 +47,9 @@ pub fn ui_menu_main(comm: &mut Comm) -> Event<ApduHeader> {
loop {
match MultiPageMenu::new(comm, &pages).show() {
EventOrPageIndex::Event(e) => return e,
i => match i {
EventOrPageIndex::Index(2) => return ui_about_menu(comm),
EventOrPageIndex::Index(3) => ledger_device_sdk::exit_app(0),
_ => (),
},
EventOrPageIndex::Index(2) => return ui_about_menu(comm),
EventOrPageIndex::Index(3) => ledger_device_sdk::exit_app(0),
EventOrPageIndex::Index(_) => (),
}
}
}

0 comments on commit d17979b

Please sign in to comment.