Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-11-25 05:40:29 +01:00
Add feature to enable use of Option::or
in const context
Dieser Commit ist enthalten in:
Ursprung
687435c8b2
Commit
fe8e043b8a
1 geänderte Dateien mit 2 neuen und 9 gelöschten Zeilen
11
src/main.rs
11
src/main.rs
|
@ -1,4 +1,5 @@
|
|||
#![forbid(unsafe_code)]
|
||||
#![feature(const_option_ext)]
|
||||
#![cfg_attr(feature = "unstable", feature(ip))]
|
||||
// The recursion_limit is mainly triggered by the json!() macro.
|
||||
// The more key/value pairs there are the more recursion occurs.
|
||||
|
@ -76,15 +77,7 @@ const HELP: &str = "\
|
|||
-v, --version Prints the app 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();
|
||||
pub const VERSION: Option<&str> = option_env!("BWRS_VERSION").or(option_env!("VW_VERSION"));
|
||||
|
||||
fn parse_args() {
|
||||
let mut pargs = pico_args::Arguments::from_env();
|
||||
|
|
Laden …
In neuem Issue referenzieren