Skip to content

Commit

Permalink
refactor: Remove once_cell dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 22, 2022
1 parent fc499ac commit c9d883a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Expand Up @@ -70,7 +70,7 @@ suggestions = ["dep:strsim"]
# Optional
deprecated = ["clap_derive?/deprecated"] # Guided experience to prepare for next breaking release (at different stages of development, this may become default)
derive = ["clap_derive"]
cargo = ["dep:once_cell"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
cargo = [] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
wrap_help = ["dep:terminal_size", "textwrap/terminal_size"]
env = [] # Use environment variables during arg parsing
unicode = ["textwrap/unicode-width", "dep:unicase"] # Support for unicode characters in arguments and help messages
Expand All @@ -95,7 +95,6 @@ atty = { version = "0.2", optional = true }
termcolor = { version = "1.1.1", optional = true }
terminal_size = { version = "0.2.1", optional = true }
backtrace = { version = "0.3", optional = true }
once_cell = { version = "1.12.0", optional = true }

[dev-dependencies]
trybuild = "1.0.18"
Expand Down
7 changes: 0 additions & 7 deletions src/lib.rs
Expand Up @@ -129,13 +129,6 @@ pub mod _features;
#[cfg(feature = "unstable-doc")]
pub mod _tutorial;

#[doc(hidden)]
pub mod __macro_refs {
#[cfg(feature = "cargo")]
#[doc(hidden)]
pub use once_cell;
}

#[macro_use]
#[allow(missing_docs)]
mod macros;
Expand Down
13 changes: 6 additions & 7 deletions src/macros.rs
Expand Up @@ -46,13 +46,12 @@ macro_rules! crate_version {
#[macro_export]
macro_rules! crate_authors {
($sep:expr) => {{
static CACHED: clap::__macro_refs::once_cell::sync::Lazy<String> =
clap::__macro_refs::once_cell::sync::Lazy::new(|| {
env!("CARGO_PKG_AUTHORS").replace(':', $sep)
});

let s: &'static str = &*CACHED;
s
let authors = env!("CARGO_PKG_AUTHORS");
if authors.contains(':') {
$crate::Str::from(authors.replace(':', $sep))
} else {
$crate::Str::from(authors)
}
}};
() => {
env!("CARGO_PKG_AUTHORS")
Expand Down

0 comments on commit c9d883a

Please sign in to comment.