From 687435c8b2b995e90bf6f0ee619bc305e37bc183 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 1 Jan 2022 12:27:28 +0000 Subject: [PATCH] Continue to allow using `$BWRS_VERSION` --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d7bef292..67b21322 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,7 +76,15 @@ const HELP: &str = "\ -v, --version Prints the app version "; -pub const VERSION: Option<&str> = option_env!("VW_VERSION"); +// HACK: Option::or cannot be used in a constant context +const fn get_version() -> Option<&'static str> { + let bwrs_version = option_env!("BWRS_VERSION"); + match bwrs_version { + Some(_) => bwrs_version, + None => option_env!("VW_VERSION"), + } +} +pub const VERSION: Option<&str> = get_version(); fn parse_args() { let mut pargs = pico_args::Arguments::from_env();