diff --git a/imag-diary/src/delete.rs b/imag-diary/src/delete.rs index da06645f..d5fd75e7 100644 --- a/imag-diary/src/delete.rs +++ b/imag-diary/src/delete.rs @@ -13,12 +13,10 @@ use util::get_diary_name; pub fn delete(rt: &Runtime) { use libimaginteraction::ask::ask_bool; - let diaryname = get_diary_name(rt); - if diaryname.is_none() { + let diaryname = get_diary_name(rt).unwrap_or_else(|| { warn!("No diary selected. Use either the configuration file or the commandline option"); exit(1); - } - let diaryname = diaryname.unwrap(); + }); let diary = Diary::open(rt.store(), &diaryname[..]); debug!("Diary opened: {:?}", diary);