Replace is_none() -> unwrap() with unwrap_or_else()
This commit is contained in:
parent
66ccd97ef2
commit
5e739df3f8
1 changed files with 5 additions and 7 deletions
|
@ -13,13 +13,11 @@ use libimagdiary::result::Result;
|
||||||
use util::get_diary_name;
|
use util::get_diary_name;
|
||||||
|
|
||||||
pub fn create(rt: &Runtime) {
|
pub fn create(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();
|
|
||||||
|
|
||||||
let prevent_edit = rt.cli().subcommand_matches("create").unwrap().is_present("no-edit");
|
let prevent_edit = rt.cli().subcommand_matches("create").unwrap().is_present("no-edit");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue