diff --git a/bin/domain/imag-mail/src/main.rs b/bin/domain/imag-mail/src/main.rs index f43ac214..98baf7d1 100644 --- a/bin/domain/imag-mail/src/main.rs +++ b/bin/domain/imag-mail/src/main.rs @@ -80,23 +80,21 @@ fn main() { "Mail collection tool", build_ui); - rt.cli() - .subcommand_name() - .map(|name| { - debug!("Call {}", name); - match name { - "import-mail" => import_mail(&rt), - "list" => list(&rt), - "mail-store" => mail_store(&rt), - other => { - debug!("Unknown command"); - let _ = rt.handle_unknown_subcommand("imag-mail", other, rt.cli()) - .map_err_trace_exit_unwrap() - .code() - .map(::std::process::exit); - } + if let Some(name) = rt.cli().subcommand_name() { + debug!("Call {}", name); + match name { + "import-mail" => import_mail(&rt), + "list" => list(&rt), + "mail-store" => mail_store(&rt), + other => { + debug!("Unknown command"); + let _ = rt.handle_unknown_subcommand("imag-mail", other, rt.cli()) + .map_err_trace_exit_unwrap() + .code() + .map(::std::process::exit); } - }); + } + } } fn import_mail(rt: &Runtime) { diff --git a/bin/domain/imag-mail/src/ui.rs b/bin/domain/imag-mail/src/ui.rs index 82880200..346f754d 100644 --- a/bin/domain/imag-mail/src/ui.rs +++ b/bin/domain/imag-mail/src/ui.rs @@ -87,7 +87,7 @@ impl IdPathProvider for PathProvider { .map(|pb| pb.into_storeid()) .collect::>>() ) - .unwrap_or(Ok(Vec::new())) + .unwrap_or_else(|| Ok(Vec::new())) .map(Some) } }