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

Use safe unwrapping in option unwrap #1355

Merged
merged 3 commits into from
Jun 5, 2024
Merged

Use safe unwrapping in option unwrap #1355

merged 3 commits into from
Jun 5, 2024

Conversation

leighmcculloch
Copy link
Member

What

Use safe unwrapping in option unwrap in code.

Why

In Rust options can be unwrapped safely where the compiler ensures that the value is not used if set to none. Avoids the use of panic causing calls like .unwrap.

There's no functional change about this code. The code was perfectly fine as is, but over time under change it will be less brittle if we rely on the compiler being able to check that it is safe for us to unwrap a value.

Copy link
Contributor

@elizabethengelman elizabethengelman left a comment

Choose a reason for hiding this comment

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

👏 🙏

@leighmcculloch leighmcculloch marked this pull request as ready for review June 5, 2024 22:06
@leighmcculloch leighmcculloch enabled auto-merge (squash) June 5, 2024 22:06
@leighmcculloch leighmcculloch merged commit 7f8116d into main Jun 5, 2024
25 checks passed
@leighmcculloch leighmcculloch deleted the balao-alliaceous branch June 5, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants