Skip to content

Commit

Permalink
Merge pull request #5386 from amaanq/static-var-name
Browse files Browse the repository at this point in the history
fix: use SCREAMING_SNAKE_CASE for static variable `authors`
  • Loading branch information
epage authored Mar 6, 2024
2 parents 690f555 + 2aea950 commit 3ba4297
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clap_builder/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}};
() => {
Expand Down

0 comments on commit 3ba4297

Please sign in to comment.