Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Member

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
Member

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants