From 733fac95cfc6d0a3a9720c89c19e5c62cddbbe45 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 20 Jul 2022 10:45:47 +0200 Subject: [PATCH 1/3] Fix `clippy::question_mark` --- crates/lang/ir/src/ir/config.rs | 4 +--- crates/lang/ir/src/ir/trait_def/config.rs | 4 +--- 2 files changed, 2 insertions(+), 6 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, From 050e0df6ba9636a36ae60c106ed0e84950ee53e5 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 20 Jul 2022 10:46:42 +0200 Subject: [PATCH 2/3] Fix `clippy::match_like_matches_macro` --- crates/lang/ir/src/ir/trait_def/item/trait_item.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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, } From ad2b907c9f9c41bac696e9c14862561a20a586cf Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 20 Jul 2022 10:56:11 +0200 Subject: [PATCH 3/3] Update test fixtures cd crates/lang/ export TRYBUILD=overwrite cargo test --verbose --all-features --no-fail-fast --- .../tests/ui/contract/fail/message-returns-non-codec.stderr | 2 +- .../tests/ui/trait_def/fail/message_output_non_codec.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr b/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr index 31684c857ca..0a644b1c6f9 100644 --- a/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr +++ b/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr @@ -60,7 +60,7 @@ error[E0599]: the method `fire` exists for struct `ink_env::call::CallBuilder $CARGO/parity-scale-codec-3.1.5/src/codec.rs + --> $CARGO/parity-scale-codec-3.1.2/src/codec.rs | | pub trait Decode: Sized { | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr b/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr index 073ed0e683b..635afb419e1 100644 --- a/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr +++ b/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr @@ -34,7 +34,7 @@ error[E0599]: the method `fire` exists for struct `CallBuilder>, = note: the following trait bounds were not satisfied: `NonCodec: parity_scale_codec::Decode` note: the following trait must be implemented - --> $CARGO/parity-scale-codec-3.1.5/src/codec.rs + --> $CARGO/parity-scale-codec-3.1.2/src/codec.rs | | pub trait Decode: Sized { | ^^^^^^^^^^^^^^^^^^^^^^^