From f61e14ff41dc832cf8414fdd88dfcc022da525dc Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Sep 2016 17:45:46 +0200 Subject: [PATCH] Replace is_none() -> unwrap() with unwrap_or_else() --- imag-diary/src/delete.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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);