Skip to content

Commit da2907f

Browse files
committed
minor cleanup
1 parent ffae5c1 commit da2907f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

program/src/processor.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ fn next_account_to_use<'a, 'b, I: Iterator<Item = &'a AccountInfo<'b>>>(
4747
}
4848

4949
// this unusual function exists to enforce stricter constraints on the new interface without affecting the old
50-
// we call this at points where the old interface has some sysvar/config accounts
51-
// followed by an authority which it did not enforece the presence of
52-
// thus if we do *not* see a sysvar/config, we *can* enforce it, knowing that there being *no* account is always an error
50+
// we call this at points where the old interface sysvar/config followed by an authority it did not assert must be present
51+
// thus if we do *not* see sysvar/config, we *can* assert authority, knowing that there being *no* account is always an error
5352
// doing it this way is non-breaking, and we can consider breaking the old interface after people switch over
5453
// we return () to prevent refactors where the caller uses the result, because it might not be the desired account
5554
fn consume_next_normal_account<T, I: Iterator<Item = T>>(iter: &mut I) -> Result<(), ProgramError> {
56-
match iter.next() {
57-
Some(_) => Ok(()),
58-
None => Err(ProgramError::NotEnoughAccountKeys),
59-
}
55+
iter.next()
56+
.map(|_| ())
57+
.ok_or(ProgramError::NotEnoughAccountKeys)
6058
}
6159

6260
fn get_vote_state(vote_account_info: &AccountInfo) -> Result<Box<VoteState>, ProgramError> {

0 commit comments

Comments
 (0)