From 7428b60eefe256719a8cffb3cd6332fe52606b94 Mon Sep 17 00:00:00 2001 From: Maciej Modelski Date: Wed, 16 Aug 2023 12:26:03 +0000 Subject: [PATCH] combine from and spender into a tuple to avoid clippy 7 function argument limit --- cycles-ledger/src/main.rs | 3 +-- cycles-ledger/src/storage.rs | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cycles-ledger/src/main.rs b/cycles-ledger/src/main.rs index 5941ce0..c5009ae 100644 --- a/cycles-ledger/src/main.rs +++ b/cycles-ledger/src/main.rs @@ -436,8 +436,7 @@ fn icrc2_approve(args: ApproveArgs) -> Result { } let txid = storage::approve( - &from_account, - &args.spender, + (&from_account, &args.spender), amount, args.expires_at, now, diff --git a/cycles-ledger/src/storage.rs b/cycles-ledger/src/storage.rs index fcea024..e2b0045 100644 --- a/cycles-ledger/src/storage.rs +++ b/cycles-ledger/src/storage.rs @@ -419,8 +419,7 @@ pub fn allowance(account: &Account, spender: &Account, now: u64) -> (u128, u64) } pub fn approve( - from: &Account, - spender: &Account, + from_spender: (&Account, &Account), amount: u128, expires_at: Option, now: u64, @@ -428,6 +427,8 @@ pub fn approve( memo: Option, created_at_time: Option, ) -> Result { + let from = from_spender.0; + let spender = from_spender.1; let from_key = to_account_key(from); let from_balance = read_state(|s| s.balances.get(&from_key).unwrap_or_default());