From b2b8f013af147469ed093d27cd5da8c0e21bef88 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Sep 2016 17:57:12 +0200 Subject: [PATCH] Replace is_none() -> unwrap() with unwrap_or_else() --- imag-diary/src/list.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/imag-diary/src/list.rs b/imag-diary/src/list.rs index 464fb3e9..757cf3a1 100644 --- a/imag-diary/src/list.rs +++ b/imag-diary/src/list.rs @@ -12,12 +12,10 @@ use libimagerror::trace::trace_error; use util::get_diary_name; pub fn list(rt: &Runtime) { - 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(); + }); fn entry_to_location_listing_string(e: &Entry) -> String { e.get_location().clone()