Skip to content

Commit a9bb8fe

Browse files
authored
Fix atoms module name generated by the NifStruct derive macro (#585)
This is related to #573, but now the macro is given a warning even with the annotation to ignore. So this is a fix that turns the atoms module name generated by the macro in a snake case name.
1 parent bf1385a commit a9bb8fe

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rustler_codegen/src/context.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ impl<'a> Context<'a> {
8686
}
8787

8888
pub fn atoms_module_name(&self, span: Span) -> Ident {
89-
Ident::new(&format!("RUSTLER_ATOMS_{}", self.ident), span)
89+
Ident::new(
90+
&format!("rustler_atoms_{}", self.ident).to_snake_case(),
91+
span,
92+
)
9093
}
9194

9295
pub fn encode(&self) -> bool {

rustler_codegen/src/ex_struct.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ pub fn transcoder_decorator(ast: &syn::DeriveInput, add_exception: bool) -> Toke
5353
};
5454

5555
let gen = quote! {
56-
#[allow(non_snake_case)]
5756
mod #atoms_module_name {
5857
#atom_defs
5958
}

0 commit comments

Comments
 (0)