[No-auto] bin/domain/diary: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:05:34 +02:00 committed by Matthias Beyer
parent 397bcd43d0
commit 1bb6f452e9
2 changed files with 20 additions and 22 deletions

View file

@ -126,7 +126,7 @@ fn create_id_from_clispec(create: &ArgMatches, timed_type: Timed) -> NaiveDateTi
.map_err(|_| warn!("Could not parse minute: '{}'", s)) .map_err(|_| warn!("Could not parse minute: '{}'", s))
.ok() .ok()
}) })
.unwrap_or(ndt.minute()); .unwrap_or_else(|| ndt.minute());
ndt.with_minute(min) ndt.with_minute(min)
.unwrap_or_else(|| { .unwrap_or_else(|| {
@ -146,7 +146,7 @@ fn create_id_from_clispec(create: &ArgMatches, timed_type: Timed) -> NaiveDateTi
.map_err(|_| warn!("Could not parse minute: '{}'", s)) .map_err(|_| warn!("Could not parse minute: '{}'", s))
.ok() .ok()
}) })
.unwrap_or(ndt.minute()); .unwrap_or_else(|| ndt.minute());
let sec = create let sec = create
.value_of("second") .value_of("second")
@ -156,7 +156,7 @@ fn create_id_from_clispec(create: &ArgMatches, timed_type: Timed) -> NaiveDateTi
.map_err(|_| warn!("Could not parse second: '{}'", s)) .map_err(|_| warn!("Could not parse second: '{}'", s))
.ok() .ok()
}) })
.unwrap_or(ndt.second()); .unwrap_or_else(|| ndt.second());
ndt.with_minute(min) ndt.with_minute(min)
.unwrap_or_else(|| { .unwrap_or_else(|| {

View file

@ -79,25 +79,23 @@ fn main() {
"Personal Diary/Diaries", "Personal Diary/Diaries",
ui::build_ui); ui::build_ui);
rt.cli() if let Some(name) = rt.cli().subcommand_name() {
.subcommand_name() debug!("Call {}", name);
.map(|name| { match name {
debug!("Call {}", name); "diaries" => diaries(&rt),
match name { "create" => create(&rt),
"diaries" => diaries(&rt), "delete" => delete(&rt),
"create" => create(&rt), "list" => list(&rt),
"delete" => delete(&rt), "view" => view(&rt),
"list" => list(&rt), other => {
"view" => view(&rt), debug!("Unknown command");
other => { let _ = rt.handle_unknown_subcommand("imag-diary", other, rt.cli())
debug!("Unknown command"); .map_err_trace_exit_unwrap()
let _ = rt.handle_unknown_subcommand("imag-diary", other, rt.cli()) .code()
.map_err_trace_exit_unwrap() .map(::std::process::exit);
.code() },
.map(::std::process::exit); }
}, }
}
});
} }
fn diaries(rt: &Runtime) { fn diaries(rt: &Runtime) {