Replace is_none() -> unwrap() with unwrap_or_else()

This commit is contained in:
Matthias Beyer 2016-09-04 17:45:46 +02:00
parent 5e739df3f8
commit f61e14ff41

View file

@ -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);