1- #![ allow( clippy:: unused_unit) ]
21#![ cfg_attr( not( feature = "std" ) , no_std) ]
2+ #![ allow( clippy:: unused_unit) ]
3+ #![ allow( clippy:: too_many_arguments) ]
34
45mod mock;
56mod tests;
@@ -275,8 +276,8 @@ impl<T: Config> Pallet<T> {
275276 Self :: claim_one (
276277 withdrawn_rewards,
277278 * reward_currency,
278- share,
279- total_reward,
279+ share. to_owned ( ) ,
280+ total_reward. to_owned ( ) ,
280281 total_shares,
281282 total_withdrawn_reward,
282283 who,
@@ -302,8 +303,8 @@ impl<T: Config> Pallet<T> {
302303 Self :: claim_one (
303304 withdrawn_rewards,
304305 reward_currency,
305- share,
306- total_reward,
306+ share. to_owned ( ) ,
307+ total_reward. to_owned ( ) ,
307308 total_shares,
308309 total_withdrawn_reward,
309310 who,
@@ -315,12 +316,11 @@ impl<T: Config> Pallet<T> {
315316 } ) ;
316317 }
317318
318- #[ allow( clippy:: too_many_arguments) ] // just we need to have all these to do the stuff
319319 fn claim_one (
320320 withdrawn_rewards : & mut BTreeMap < T :: CurrencyId , T :: Balance > ,
321321 reward_currency : T :: CurrencyId ,
322- share : & mut T :: Share ,
323- total_reward : & mut T :: Balance ,
322+ share : T :: Share ,
323+ total_reward : T :: Balance ,
324324 total_shares : U256 ,
325325 total_withdrawn_reward : & mut T :: Balance ,
326326 who : & T :: AccountId ,
@@ -332,7 +332,7 @@ impl<T: Config> Pallet<T> {
332332 total_reward,
333333 total_shares,
334334 withdrawn_reward,
335- total_withdrawn_reward,
335+ total_withdrawn_reward. to_owned ( ) ,
336336 ) ;
337337 if !reward_to_withdraw. is_zero ( ) {
338338 * total_withdrawn_reward = total_withdrawn_reward. saturating_add ( reward_to_withdraw) ;
@@ -344,20 +344,20 @@ impl<T: Config> Pallet<T> {
344344 }
345345
346346 fn reward_to_withdraw (
347- share : & mut T :: Share ,
348- total_reward : & mut T :: Balance ,
347+ share : T :: Share ,
348+ total_reward : T :: Balance ,
349349 total_shares : U256 ,
350350 withdrawn_reward : T :: Balance ,
351- total_withdrawn_reward : & mut T :: Balance ,
351+ total_withdrawn_reward : T :: Balance ,
352352 ) -> T :: Balance {
353- let total_reward_proportion: T :: Balance = U256 :: from ( share. to_owned ( ) . saturated_into :: < u128 > ( ) )
354- . saturating_mul ( U256 :: from ( total_reward. to_owned ( ) . saturated_into :: < u128 > ( ) ) )
353+ let total_reward_proportion: T :: Balance = U256 :: from ( share. saturated_into :: < u128 > ( ) )
354+ . saturating_mul ( U256 :: from ( total_reward. saturated_into :: < u128 > ( ) ) )
355355 . checked_div ( total_shares)
356356 . unwrap_or_default ( )
357357 . as_u128 ( )
358358 . unique_saturated_into ( ) ;
359359 total_reward_proportion
360360 . saturating_sub ( withdrawn_reward)
361- . min ( total_reward. saturating_sub ( * total_withdrawn_reward) )
361+ . min ( total_reward. saturating_sub ( total_withdrawn_reward) )
362362 }
363363}
0 commit comments