Merge pull request #5386 from amaanq/static-var-name

fix: use SCREAMING_SNAKE_CASE for static variable `authors`
This commit is contained in:
Ed Page 2024-03-06 10:49:29 -06:00 committed by GitHub
commit 3ba429752f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,14 +42,14 @@ macro_rules! crate_version {
#[macro_export]
macro_rules! crate_authors {
($sep:expr) => {{
static authors: &str = env!("CARGO_PKG_AUTHORS");
if authors.contains(':') {
static AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
if AUTHORS.contains(':') {
static CACHED: std::sync::OnceLock<String> = std::sync::OnceLock::new();
let s = CACHED.get_or_init(|| authors.replace(':', $sep));
let s = CACHED.get_or_init(|| AUTHORS.replace(':', $sep));
let s: &'static str = &*s;
s
} else {
authors
AUTHORS
}
}};
() => {