From 8c4122d7c6a79dc3995b5e9eed46e9dfd3531b94 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Thu, 15 Feb 2024 23:39:08 +0800 Subject: [PATCH] remove clippy warning and error from genrated files. --- stm32-metapac-gen/src/lib.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs index 474d29b..999c750 100644 --- a/stm32-metapac-gen/src/lib.rs +++ b/stm32-metapac-gen/src/lib.rs @@ -186,9 +186,9 @@ impl Gen { write!( &mut data, " - pub(crate) static PERIPHERALS: &'static [Peripheral] = {}; - pub(crate) static INTERRUPTS: &'static [Interrupt] = {}; - pub(crate) static DMA_CHANNELS: &'static [DmaChannel] = {}; + pub(crate) static PERIPHERALS: &[Peripheral] = {}; + pub(crate) static INTERRUPTS: &[Interrupt] = {}; + pub(crate) static DMA_CHANNELS: &[DmaChannel] = {}; ", stringify(&core.peripherals), stringify(&core.interrupts), @@ -329,6 +329,16 @@ impl Gen { .join(format!("{}_{}.rs", module, version)), ) .unwrap(); + + // Allow a few warning + file.write_all( + b"#![allow(clippy::missing_safety_doc)] + #![allow(clippy::identity_op)] + #![allow(clippy::unnecessary_cast)] + #![allow(clippy::erasing_op)]", + ) + .unwrap(); + let data = items.to_string().replace("] ", "]\n"); // Remove inner attributes like #![no_std]