From adf16368689ec7a14ec88267de5923038169e81b Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 18 Oct 2022 21:15:22 +0300 Subject: [PATCH] Fix clippy suggestion (#1310), Fixes for nightly changes (#1327) --- crates/lang/ir/src/ir/config.rs | 4 +--- crates/lang/ir/src/ir/trait_def/config.rs | 4 +--- crates/lang/ir/src/ir/trait_def/item/mod.rs | 2 +- crates/lang/ir/src/ir/trait_def/item/trait_item.rs | 12 ++++-------- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/crates/lang/ir/src/ir/config.rs b/crates/lang/ir/src/ir/config.rs index 87db651bfa8..1550b8447c2 100644 --- a/crates/lang/ir/src/ir/config.rs +++ b/crates/lang/ir/src/ir/config.rs @@ -131,9 +131,7 @@ impl TryFrom for Config { )) } } else if arg.name.is_ident("keep_attr") { - if let Err(err) = whitelisted_attributes.parse_arg_value(&arg) { - return Err(err) - } + whitelisted_attributes.parse_arg_value(&arg)?; } else { return Err(format_err_spanned!( arg, diff --git a/crates/lang/ir/src/ir/trait_def/config.rs b/crates/lang/ir/src/ir/trait_def/config.rs index c0f1e524176..a7b82e231e0 100644 --- a/crates/lang/ir/src/ir/trait_def/config.rs +++ b/crates/lang/ir/src/ir/trait_def/config.rs @@ -92,9 +92,7 @@ impl TryFrom for TraitDefinitionConfig { )) } } else if arg.name.is_ident("keep_attr") { - if let Err(err) = whitelisted_attributes.parse_arg_value(&arg) { - return Err(err) - } + whitelisted_attributes.parse_arg_value(&arg)?; } else { return Err(format_err_spanned!( arg, diff --git a/crates/lang/ir/src/ir/trait_def/item/mod.rs b/crates/lang/ir/src/ir/trait_def/item/mod.rs index 3edfb6ba929..39a58a75520 100644 --- a/crates/lang/ir/src/ir/trait_def/item/mod.rs +++ b/crates/lang/ir/src/ir/trait_def/item/mod.rs @@ -287,7 +287,7 @@ impl InkItemTrait { /// Constructors are generally not allowed in ink! trait definitions. fn analyse_trait_constructor(constructor: &syn::TraitItemMethod) -> Result<()> { - return Err(format_err!( + Err(format_err!( constructor.span(), "ink! trait definitions must not have constructors", )) diff --git a/crates/lang/ir/src/ir/trait_def/item/trait_item.rs b/crates/lang/ir/src/ir/trait_def/item/trait_item.rs index e621b4a3379..01644e148f9 100644 --- a/crates/lang/ir/src/ir/trait_def/item/trait_item.rs +++ b/crates/lang/ir/src/ir/trait_def/item/trait_item.rs @@ -176,14 +176,10 @@ impl<'a> InkTraitMessage<'a> { true } syn::FnArg::Typed(pat_type) => { - match &*pat_type.ty { - syn::Type::Reference(reference) - if reference.mutability.is_some() => - { - true - } - _ => false, - } + matches!( + &*pat_type.ty, + syn::Type::Reference(reference) if reference.mutability.is_some() + ) } _ => false, }