Fix derive macro for pub(crate) visibility

This commit is contained in:
Lukas Kalbertodt
2021-07-24 17:00:54 +02:00
parent 7561e82215
commit 522494aa5c
2 changed files with 6 additions and 1 deletions

View File

@@ -333,6 +333,11 @@ fn inner_visibility(outer: &syn::Visibility) -> TokenStream {
// The inherited one is relative to the parent module.
syn::Visibility::Inherited => quote! { pub(super) },
// For `pub(crate)`
syn::Visibility::Restricted(r) if r.path.is_ident("crate") && r.in_token.is_none() => {
quote! { pub(crate) }
},
// If the path in the `pub(in <path>)` visibility is absolute, we can
// use it like that as well.
syn::Visibility::Restricted(r) if r.path.leading_colon.is_some() => quote! { outer },

View File

@@ -90,7 +90,7 @@ pub trait Partial: for<'de> Deserialize<'de> {
fn with_fallback(self, fallback: Self) -> Self;
}
/// A source of configuration values for the configuration object `T`, e.g. a
/// A source of configuration values for the configuration object `C`, e.g. a
/// file or environment variables.
pub trait Source<C: Config> {
/// Attempts to load a potentially partially configuration object.