diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-08-30 16:25:48 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-08-30 16:25:48 +0200 |
| commit | 1e85c86bc6d289d9840507303501fe4d4ee9fe6a (patch) | |
| tree | 25c3e1de42057d1d265aa48e6996dce4447539d7 | |
| parent | 7a99915ff1c32d75fd5806ff85d7a9f2633c39a7 (diff) | |
| download | mullvadvpn-1e85c86bc6d289d9840507303501fe4d4ee9fe6a.tar.xz mullvadvpn-1e85c86bc6d289d9840507303501fe4d4ee9fe6a.zip | |
Make product_version a constant
| -rw-r--r-- | mullvad-problem-report/src/main.rs | 2 | ||||
| -rw-r--r-- | mullvad-problem-report/src/metadata.rs | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs index a38615afef..b881c9d8d5 100644 --- a/mullvad-problem-report/src/main.rs +++ b/mullvad-problem-report/src/main.rs @@ -86,7 +86,7 @@ quick_main!(run); fn run() -> Result<()> { let app = clap::App::new("problem-report") - .version(metadata::product_version()) + .version(metadata::PRODUCT_VERSION) .author(crate_authors!()) .about("Mullvad VPN problem report tool. Collects logs and sends them to Mullvad support.") .setting(clap::AppSettings::SubcommandRequired) diff --git a/mullvad-problem-report/src/metadata.rs b/mullvad-problem-report/src/metadata.rs index 6cc5338769..d176d66c45 100644 --- a/mullvad-problem-report/src/metadata.rs +++ b/mullvad-problem-report/src/metadata.rs @@ -2,25 +2,23 @@ use std::collections::HashMap; use std::process::Command; use uuid; +pub const PRODUCT_VERSION: &str = concat!( + include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")), + " ", + include_str!(concat!(env!("OUT_DIR"), "/git-commit-date.txt")) +); + pub fn collect() -> HashMap<String, String> { let mut metadata = HashMap::new(); metadata.insert("id".to_owned(), uuid::Uuid::new_v4().to_string()); metadata.insert( "mullvad-product-version".to_owned(), - product_version().to_owned(), + PRODUCT_VERSION.to_owned(), ); metadata.insert("os".to_owned(), os::version()); metadata } -pub fn product_version() -> &'static str { - concat!( - include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")), - " ", - include_str!(concat!(env!("OUT_DIR"), "/git-commit-date.txt")) - ) -} - #[cfg(target_os = "linux")] mod os { extern crate rs_release; |
