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 committed Nov 23, 2023
1 parent 1425aa7 commit bfe8eb4
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/app_ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ fn ui_about_menu(comm: &mut Comm) -> Event<ApduHeader> {
loop {
match MultiPageMenu::new(comm, &pages).show() {
EventOrPageIndex::Event(e) => return e,
i => match i {
EventOrPageIndex::Index(1) => return ui_menu_main(comm),
_ => (),
},
EventOrPageIndex::Index(1) => return ui_menu_main(comm),
EventOrPageIndex::Index(_) => (),
}
}
}
Expand All @@ -49,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 bfe8eb4

Please sign in to comment.