Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Do not hold vote_state lock guard in match statement #25094

Conversation

brooksprumo
Copy link
Contributor

Problem

The vote_state lock guard is held in a match statement. Refer to #24836 for more info, and #24836 (comment) for the clippy output pertaining to this PR.

Summary of Changes

Do not hold vote_state lock guard in match scrutinee.

let vote_state = vote_account
.vote_state()
.as_ref()
.map_err(|_| {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does using map_err here actually release the lock?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes because map_err consumes self

@jstarry
Copy link
Contributor

jstarry commented May 10, 2022

I don't think this usage is problematic, probably not worth fixing just to address the lint warning

@brooksprumo brooksprumo deleted the significant-drop-in-scrutinee/bank/vote_state branch May 10, 2022 13:42
@brooksprumo brooksprumo restored the significant-drop-in-scrutinee/bank/vote_state branch May 10, 2022 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants