Skip to content

Commit

Permalink
removed underscores for public types and modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptistemontan committed Aug 30, 2023
1 parent 71385d4 commit bb6f745
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions leptos_i18n_macro/src/load_locales/interpolate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct Field<'a> {

impl Interpolation {
pub fn new(key: &Key, keys_set: &HashSet<InterpolateKey>, locales: &[Locale]) -> Self {
let ident = syn::Ident::new(&format!("__{}_builder", key.name), Span::call_site());
let ident = syn::Ident::new(&format!("{}_builder", key.name), Span::call_site());

let locale_field = Key::new("__locale", super::key::KeyKind::LocaleName).unwrap();

Expand All @@ -43,7 +43,7 @@ impl Interpolation {
let new_impl = Self::new_impl(&ident, &locale_field, &fields);
let default_generics = fields
.iter()
.map(|_| quote!(_builders::EmptyInterpolateValue));
.map(|_| quote!(builders::EmptyInterpolateValue));
let default_generic_ident = quote!(#ident<#(#default_generics,)*>);

let imp = quote! {
Expand Down
14 changes: 7 additions & 7 deletions leptos_i18n_macro/src/load_locales/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ fn create_locale_type_inner(

let builder_fields = builders.iter().map(|(key, inter)| {
let inter_ident = &inter.default_generic_ident;
quote!(pub #key: _builders::#inter_ident)
quote!(pub #key: builders::#inter_ident)
});

let init_builder_fields: Vec<TokenStream> = builders
.iter()
.map(|(key, inter)| {
let ident = &inter.ident;
quote!(#key: _builders::#ident::new(_variant))
quote!(#key: builders::#ident::new(_variant))
})
.collect();

Expand Down Expand Up @@ -169,7 +169,7 @@ fn create_locale_type_inner(
let empty_type = create_empty_type();
quote! {
#[doc(hidden)]
pub mod _builders {
pub mod builders {
use super::LocaleEnum;

#empty_type
Expand Down Expand Up @@ -251,7 +251,7 @@ fn create_namespaces_types(
) -> TokenStream {
let namespaces_ts = namespaces.iter().map(|namespace| {
let namespace_ident = &namespace.key.ident;
let namespace_module_ident = format_ident!("__{}_mod", namespace_ident);
let namespace_module_ident = format_ident!("ns_{}", namespace_ident);
let builders_keys = keys.get(&namespace.key).unwrap();
let type_impl =
create_locale_type_inner(namespace_ident, &namespace.locales, builders_keys, true);
Expand All @@ -267,13 +267,13 @@ fn create_namespaces_types(
let namespaces_fields = namespaces.iter().map(|namespace| {
let key = &namespace.key;
let namespace_module_ident = format_ident!("__{}_mod", &key.ident);
quote!(pub #key: __namespaces::#namespace_module_ident::#key)
quote!(pub #key: namespaces::#namespace_module_ident::#key)
});

let namespaces_fields_new = namespaces.iter().map(|namespace| {
let key = &namespace.key;
let namespace_module_ident = format_ident!("__{}_mod", &key.ident);
quote!(#key: __namespaces::#namespace_module_ident::#key::new(_variant))
quote!(#key: namespaces::#namespace_module_ident::#key::new(_variant))
});

let locales = &namespaces.iter().next().unwrap().locales;
Expand All @@ -289,7 +289,7 @@ fn create_namespaces_types(
});

quote! {
pub mod __namespaces {
pub mod namespaces {
use super::{LocaleEnum, Locales};

#(
Expand Down

0 comments on commit bb6f745

Please sign in to comment.