From 25f06afa247f6a6e1c9d9103dafa55d6885951b0 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Wed, 21 Aug 2024 08:53:28 +0100 Subject: [PATCH] Appease rust 1.80 clippies (#1663) Signed-off-by: Sean Young --- src/codegen/polkadot.rs | 2 +- src/codegen/statements/mod.rs | 10 +++------- src/sema/ast.rs | 2 +- src/sema/external_functions.rs | 4 ++-- tests/solana.rs | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/codegen/polkadot.rs b/src/codegen/polkadot.rs index 511eec0c9..65871d260 100644 --- a/src/codegen/polkadot.rs +++ b/src/codegen/polkadot.rs @@ -98,7 +98,7 @@ impl RetCodeCheckBuilder { impl RetCodeCheck { /// Handles all cases from the [RetBlock] accordingly. - /// * On success, nothing is done and the execution continues at the success block. + /// On success, nothing is done and the execution continues at the success block. /// If the callee reverted and output was supplied, it will be bubble up. /// Otherwise, a revert without data will be inserted. pub(crate) fn handle_cases( diff --git a/src/codegen/statements/mod.rs b/src/codegen/statements/mod.rs index ef1172ed5..e8d3782e3 100644 --- a/src/codegen/statements/mod.rs +++ b/src/codegen/statements/mod.rs @@ -1208,9 +1208,7 @@ pub fn process_side_effects_expressions( } ast::Expression::Builtin { - kind: builtin_type, .. - } => match &builtin_type { - ast::Builtin::PayableSend + kind: ast::Builtin::PayableSend | ast::Builtin::ArrayPush | ast::Builtin::ArrayPop // PayableTransfer, Revert, Require and SelfDestruct do not occur inside an expression @@ -1229,12 +1227,10 @@ pub fn process_side_effects_expressions( | ast::Builtin::WriteUint64LE | ast::Builtin::WriteUint128LE | ast::Builtin::WriteUint256LE - | ast::Builtin::WriteAddress => { + | ast::Builtin::WriteAddress, .. + } => { let _ = expression(exp, ctx.cfg, ctx.contract_no, ctx.func, ctx.ns, ctx.vartab, ctx.opt); false - } - - _ => true, }, _ => true, diff --git a/src/sema/ast.rs b/src/sema/ast.rs index 9a66a385f..1cfdf3a56 100644 --- a/src/sema/ast.rs +++ b/src/sema/ast.rs @@ -1281,7 +1281,7 @@ pub struct CallArgs { /// This enum manages the accounts in an external call on Solana. There can be three options: /// 1. The developer explicitly specifies there are not accounts for the call (`NoAccount`). /// 2. The accounts call argument is absent, in which case we attempt to generate the AccountMetas -/// vector automatically (`AbsentArgumet`). +/// vector automatically (`AbsentArgumet`). /// 3. There are accounts specified in the accounts call argument (Present). #[derive(PartialEq, Eq, Clone, Debug, Default)] pub enum ExternalCallAccounts { diff --git a/src/sema/external_functions.rs b/src/sema/external_functions.rs index a8e1fdf5d..d46270ade 100644 --- a/src/sema/external_functions.rs +++ b/src/sema/external_functions.rs @@ -169,8 +169,8 @@ fn check_statement(stmt: &Statement, call_list: &mut CallList) -> bool { } } } - Statement::Return(_, exprs) => { - for e in exprs { + Statement::Return(_, expr) => { + if let Some(e) = expr { e.recurse(call_list, check_expression); } } diff --git a/tests/solana.rs b/tests/solana.rs index 512ab9a45..da054ede5 100644 --- a/tests/solana.rs +++ b/tests/solana.rs @@ -917,9 +917,9 @@ fn sol_log_data( result ); - print!(" {}", hex::encode(&event)); - events.push(event.to_vec()); + + print!(" {}", hex::encode(event)); } println!();