Replace is_none() -> unwrap() with unwrap_or_else()
This commit is contained in:
parent
b2b8f013af
commit
6b5d91e447
1 changed files with 3 additions and 4 deletions
|
@ -9,12 +9,11 @@ use libimagerror::trace::trace_error;
|
||||||
use util::get_diary_name;
|
use util::get_diary_name;
|
||||||
|
|
||||||
pub fn view(rt: &Runtime) {
|
pub fn view(rt: &Runtime) {
|
||||||
let diaryname = get_diary_name(rt);
|
let diaryname = get_diary_name(rt).unwrap_or_else(|| {
|
||||||
if diaryname.is_none() {
|
|
||||||
warn!("No diary name");
|
warn!("No diary name");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
});
|
||||||
let diaryname = diaryname.unwrap();
|
|
||||||
let diary = Diary::open(rt.store(), &diaryname[..]);
|
let diary = Diary::open(rt.store(), &diaryname[..]);
|
||||||
let show_header = rt.cli().subcommand_matches("view").unwrap().is_present("show-header");
|
let show_header = rt.cli().subcommand_matches("view").unwrap().is_present("show-header");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue