From e1e5f2c2beaf3ba0fd7e6be992119166934d775b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 20 Apr 2020 09:26:27 +0200 Subject: [PATCH] version slice --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f3d9ac4..e09be2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,8 +41,8 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default { fn configure<'a>(self, _clap: &clap::ArgMatches<'a>) -> Fallible; /// Initialize the app - fn init(name: &str, cfg_file_name: &str, version: Option) -> Fallible { - let version: String = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION").into()); + fn init(name: &str, cfg_file_name: &str, version: Option<&str>) -> Fallible { + 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();