Remove folds (#10128)

automerge
This commit is contained in:
Greg Fitzgerald
2020-05-19 19:13:41 -06:00
committed by GitHub
parent 439fd30840
commit d9919b99d2
7 changed files with 52 additions and 54 deletions

View File

@@ -323,11 +323,13 @@ fn main() -> Result<(), Box<dyn error::Error>> {
let total_current_stake = vote_accounts
.current
.iter()
.fold(0, |acc, vote_account| acc + vote_account.activated_stake);
.map(|vote_account| vote_account.activated_stake)
.sum();
let total_delinquent_stake = vote_accounts
.delinquent
.iter()
.fold(0, |acc, vote_account| acc + vote_account.activated_stake);
.map(|vote_account| vote_account.activated_stake)
.sum();
let total_stake = total_current_stake + total_delinquent_stake;
let current_stake_percent = total_current_stake * 100 / total_stake;