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

This commit is contained in:
Matthias Beyer 2016-09-04 17:57:12 +02:00
parent b7c8fa4d18
commit b2b8f013af

View file

@ -12,12 +12,10 @@ use libimagerror::trace::trace_error;
use util::get_diary_name; use util::get_diary_name;
pub fn list(rt: &Runtime) { pub fn list(rt: &Runtime) {
let diaryname = get_diary_name(rt); let diaryname = get_diary_name(rt).unwrap_or_else(|| {
if diaryname.is_none() {
warn!("No diary selected. Use either the configuration file or the commandline option"); warn!("No diary selected. Use either the configuration file or the commandline option");
exit(1); exit(1);
} });
let diaryname = diaryname.unwrap();
fn entry_to_location_listing_string(e: &Entry) -> String { fn entry_to_location_listing_string(e: &Entry) -> String {
e.get_location().clone() e.get_location().clone()