version slice

This commit is contained in:
2020-04-20 09:26:27 +02:00
parent 298a219613
commit e1e5f2c2be
+3 -3
View File
@@ -41,8 +41,8 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default {
fn configure<'a>(self, _clap: &clap::ArgMatches<'a>) -> Fallible<Self::Init>;
/// Initialize the app
fn init(name: &str, cfg_file_name: &str, version: Option<String>) -> Fallible<Self::Init> {
let version: String = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION").into());
fn init(name: &str, cfg_file_name: &str, version: Option<&str>) -> Fallible<Self::Init> {
let version = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION"));
let clap = clap::App::new(name)
.arg(
clap::Arg::with_name("config")
@@ -88,7 +88,7 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default {
let clap = Self::add_args(clap);
// this must be done after `add_args` or all hell breaks loose around lifetimes
let clap = clap.version(version.as_str());
let clap = clap.version(version);
let argv = clap.get_matches();