Skip to content

Commit bdc33ba

Browse files
authored
Remove unnecessary Option (solana-labs#21569)
1 parent bf5b7f5 commit bdc33ba

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

runtime/src/stakes.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,8 @@ impl Stakes {
6868
.vote_accounts
6969
.iter()
7070
.map(|(pubkey, (_ /*stake*/, account))| {
71-
let stake = self.calculate_stake(
72-
pubkey,
73-
next_epoch,
74-
Some(&stake_history_upto_prev_epoch),
75-
);
71+
let stake =
72+
self.calculate_stake(pubkey, next_epoch, &stake_history_upto_prev_epoch);
7673
(*pubkey, (stake, account.clone()))
7774
})
7875
.collect();
@@ -159,13 +156,14 @@ impl Stakes {
159156
&self,
160157
voter_pubkey: &Pubkey,
161158
epoch: Epoch,
162-
stake_history: Option<&StakeHistory>,
159+
stake_history: &StakeHistory,
163160
) -> u64 {
164161
let matches_voter_pubkey = |(_, stake_delegation): &(&_, &Delegation)| {
165162
&stake_delegation.voter_pubkey == voter_pubkey
166163
};
167-
let get_stake =
168-
|(_, stake_delegation): (_, &Delegation)| stake_delegation.stake(epoch, stake_history);
164+
let get_stake = |(_, stake_delegation): (_, &Delegation)| {
165+
stake_delegation.stake(epoch, Some(stake_history))
166+
};
169167

170168
self.stake_delegations
171169
.iter()
@@ -205,7 +203,7 @@ impl Stakes {
205203
if account.lamports() != 0 && VoteState::is_correct_size_and_initialized(account.data())
206204
{
207205
let stake = old.as_ref().map_or_else(
208-
|| self.calculate_stake(pubkey, self.epoch, Some(&self.stake_history)),
206+
|| self.calculate_stake(pubkey, self.epoch, &self.stake_history),
209207
|v| v.0,
210208
);
211209

0 commit comments

Comments
 (0)