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

This commit is contained in:
Matthias Beyer 2016-09-04 17:54:35 +02:00
parent f61e14ff41
commit b7c8fa4d18

View file

@ -15,12 +15,11 @@ use libimagtimeui::parse::Parse;
use util::get_diary_name;
pub fn edit(rt: &Runtime) {
let diaryname = get_diary_name(rt);
if diaryname.is_none() {
let diaryname = get_diary_name(rt).unwrap_or_else(|| {
warn!("No diary name");
exit(1);
}
let diaryname = diaryname.unwrap();
});
let diary = Diary::open(rt.store(), &diaryname[..]);
let datetime : Option<NaiveDateTime> = rt