Skip to content

Commit 1a794da

Browse files
committed
Add #[allow(...)] directives to macro-generated entries
This patch adds `#[allow(non_camel_case_types)]` and `#[allow(non_upper_case_globals)]` directives to generated `const`s and `struct`s. While `cargo check` by default ignores naming style inconsistencies in macro-produced code, `rust-analyzer` seems to be using a more strict mode. So annotation of generated entries allows to prevent the display of such warnings by the language server.
1 parent b2bff88 commit 1a794da

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

godot-macros/src/class/derive_godot_class.rs

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn derive_godot_class(item: venial::Item) -> ParseResult<TokenStream> {
142142
let funcs_collection_struct_name = format_funcs_collection_struct(class_name);
143143
let funcs_collection_struct = quote! {
144144
#[doc(hidden)]
145+
#[allow(non_camel_case_types)]
145146
pub struct #funcs_collection_struct_name {}
146147
};
147148

godot-macros/src/derive/derive_from_godot.rs

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ fn make_fromgodot_for_int_enum(
7575
#(
7676
// Interesting: using let instead of const would introduce a runtime bug. Its values cannot be used in match lhs (binding).
7777
// However, bindings silently shadow variables, so the first match arm always runs; no warning in generated proc-macro code.
78+
#[allow(non_upper_case_globals)]
7879
const #ord_variables: #int = #discriminants;
7980
)*
8081

0 commit comments

Comments
 (0)