Rust 我该如何对Clippy隐瞒“关于”的警告;“不需要的单位表达式”;使用基板时';什么是十二月事件?

Rust 我该如何对Clippy隐瞒“关于”的警告;“不需要的单位表达式”;使用基板时';什么是十二月事件?,rust,substrate,Rust,Substrate,具有类似于底层框架的源代码: decl_event!( pub enum Event<T> where AccountId = <T as frame_system::Config>::AccountId, ChipBalance = <T as Config>::ChipBalance, { /// Buy chips event BuyChips(AccountId,

具有类似于底层框架的源代码:

decl_event!(
    pub enum Event<T>
    where
        AccountId = <T as frame_system::Config>::AccountId,
        ChipBalance = <T as Config>::ChipBalance,
    {
        /// Buy chips event
        BuyChips(AccountId, ChipBalance),
        /// Redemption amount with chips event
        Redemption(AccountId, ChipBalance),
        /// Pledge chips
        Reserve(AccountId, ChipBalance),
        /// Cancel pledge chips
        Unreserve(AccountId, ChipBalance),
        /// Transfer the chips in the pledge to others
        RepatriateReserved(AccountId, AccountId, ChipBalance),
    }
);

有没有更好的解决方案来隐藏为Clippy lints创建自定义规则的警告?

我猜这是由于for()实现中的
单元造成的。
这可以解决这个问题:

diff --git a/frame/support/procedural/src/pallet/expand/event.rs b/frame/support/procedural/src/pallet/expand/event.rs
index c4f7aeffa7..ec38c83b8b 100644
--- a/frame/support/procedural/src/pallet/expand/event.rs
+++ b/frame/support/procedural/src/pallet/expand/event.rs
@@ -133,7 +133,7 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream {
                #deposit_event
 
                impl<#event_impl_gen> From<#event_ident<#event_use_gen>> for () #event_where_clause {
-                       fn from(_: #event_ident<#event_use_gen>) -> () { () }
+                       fn from(_: #event_ident<#event_use_gen>) -> () {}
                }
 
                impl<#event_impl_gen> #event_ident<#event_use_gen> #event_where_clause {
diff --git a/frame/support/src/event.rs b/frame/support/src/event.rs
index eb666b6f02..b11166d1c6 100644
--- a/frame/support/src/event.rs
+++ b/frame/support/src/event.rs
@@ -140,7 +140,7 @@ macro_rules! decl_event {
                        )*
                }
                impl From<Event> for () {
-                       fn from(_: Event) -> () { () }
+                       fn from(_: Event) -> () {}
                }
                impl Event {
                        #[allow(dead_code)]
diff--git a/frame/support/procedural/src/pallet/expand/event.rs b/frame/support/procedural/src/pallet/expand/event.rs
索引c4f7aeffa7..ec38c83b8b 100644
---a/frame/support/procedural/src/pallet/expand/event.rs
+++b/frame/support/procedural/src/pallet/expand/event.rs
@@-133,7+133,7@@pub fn expand_事件(def:&mut def)->proc_macro2::TokenStream{
#存款事件
impl From for()#event_where_子句{
-fn from(_:#event_ident)->({()}
+fn from(_:#event_ident)->({}
}
impl#event#ident#event#where#子句{
diff——git a/frame/support/src/event.rs b/frame/support/src/event.rs
索引eb666b6f02..b11166d1c6 100644
---a/frame/support/src/event.rs
+++b/frame/support/src/event.rs
@@-140,7+140,7@@macro\u规则!decl\u事件{
)*
}
针对()的impl From{
-fn from(quo:Event)->({()}
+fn from(u:Event)->({}
}
impl事件{
#[允许(死代码)]

能否添加
#[允许(clippy::未使用的单元)]
在调用
decl_event
时,请原谅这个愚蠢的问题:没有这样的问题很好?它让你知道你有未使用的事件IIUC。所以最好解决这个问题,或者删除/注释掉未使用的事件?没有愚蠢的问题。但事实是,事件被使用了。/这不是一个不必要的代码,这就是为什么这个问题,没有使用代码我可以删除它;-)但它不是那么简单;-)