From dea9d47d0ac5aea3763afed9f0f6f541a6a8ef59 Mon Sep 17 00:00:00 2001 From: John Baber-Lucero Date: Thu, 5 May 2022 18:02:16 +0000 Subject: [PATCH] Change if to match --- TODO.md | 1 + src/lib.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/TODO.md b/TODO.md index 2f18209..57f8b60 100644 --- a/TODO.md +++ b/TODO.md @@ -3,3 +3,4 @@ - Allow placing notes are locations in the bytes. - Use cross platform colors so when compiled with mingw, still get terminal colors - vihex may handle this +- Make l/L take filename as an argument diff --git a/src/lib.rs b/src/lib.rs index 781792b..46e75cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -625,12 +625,13 @@ pub fn load_state_from_file(state: &mut ec::State) { let filename = ec::read_string_from_user(Some( "Enter filename from which to load state: ")); if filename.is_ok() { - let new_state = State::read_from_filename(&filename.unwrap()); - if new_state.is_ok() { - *state = new_state.unwrap(); - } - else { - println!("? {:?}", new_state); + match State::read_from_filename(&filename.unwrap()) { + Ok(new_state) => { + *state = new_state; + }, + Err(err) => { + println!("? {}", err); + } } } else {