Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put once_cell reexport into __macro_refs #3870

Merged
merged 1 commit into from Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions clap_derive/src/attrs.rs
Expand Up @@ -552,7 +552,7 @@ impl Attrs {
})
} else {
quote_spanned!(ident.span()=> {
static DEFAULT_VALUE: clap::once_cell::sync::Lazy<String> = clap::once_cell::sync::Lazy::new(|| {
static DEFAULT_VALUE: clap::__macro_refs::once_cell::sync::Lazy<String> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
let val: #ty = #val;
::std::string::ToString::to_string(&val)
});
Expand Down Expand Up @@ -592,7 +592,7 @@ impl Attrs {
})
} else {
quote_spanned!(ident.span()=> {
static DEFAULT_VALUE: clap::once_cell::sync::Lazy<::std::ffi::OsString> = clap::once_cell::sync::Lazy::new(|| {
static DEFAULT_VALUE: clap::__macro_refs::once_cell::sync::Lazy<::std::ffi::OsString> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
let val: #ty = #val;
::std::ffi::OsString::from(val)
});
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Expand Up @@ -82,9 +82,12 @@ pub use Parser as StructOpt;
)]
pub use ValueEnum as ArgEnum;

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

#[macro_use]
#[allow(missing_docs)]
Expand Down
6 changes: 4 additions & 2 deletions src/macros.rs
Expand Up @@ -250,8 +250,10 @@ macro_rules! crate_version {
#[macro_export]
macro_rules! crate_authors {
($sep:expr) => {{
static CACHED: clap::once_cell::sync::Lazy<String> =
clap::once_cell::sync::Lazy::new(|| env!("CARGO_PKG_AUTHORS").replace(':', $sep));
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
Expand Down
4 changes: 2 additions & 2 deletions tests/derive_ui/next/bool_value_enum.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `bool: ValueEnum` is not satisfied
error[E0277]: the trait bound `bool: ArgEnum` is not satisfied
--> tests/derive_ui/next/bool_value_enum.rs:6:31
|
6 | #[clap(short, value_enum, default_value_t)]
| ^^^^^^^^^^^^^^^ the trait `ValueEnum` is not implemented for `bool`
| ^^^^^^^^^^^^^^^ the trait `ArgEnum` is not implemented for `bool`
|
note: required by `to_possible_value`
--> src/derive.rs
Expand Down