Codegen: Preserve attrs and add #[allow(clippy::all)] (#784)

* Preserve attrs on codegen and ignore all clippy on generated code

* tweak and test attr preservation
This commit is contained in:
James Wilson
2023-01-17 09:42:04 +00:00
committed by GitHub
parent a3713476da
commit 26b8a81c17
2 changed files with 42 additions and 6 deletions
+3
View File
@@ -154,6 +154,7 @@ impl RuntimeGenerator {
derives: DerivesRegistry,
crate_path: CratePath,
) -> TokenStream2 {
let item_mod_attrs = item_mod.attrs.clone();
let item_mod_ir = ir::ItemMod::from(item_mod);
let default_derives = derives.default_derives();
@@ -325,7 +326,9 @@ impl RuntimeGenerator {
let rust_items = item_mod_ir.rust_items();
quote! {
#( #item_mod_attrs )*
#[allow(dead_code, unused_imports, non_camel_case_types)]
#[allow(clippy::all)]
pub mod #mod_ident {
// Preserve any Rust items that were previously defined in the adorned module
#( #rust_items ) *