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

Eliminate a handful of unwraps from the codebase #4622

Merged
merged 4 commits into from
May 21, 2024

Conversation

roypat
Copy link
Contributor

@roypat roypat commented May 21, 2024

Changes

Eliminate some unneeded use of unwrap from Firecracker.

Reason

While looking into the feasibility of #593, I stumbled across a few unwraps that were very simple to fix.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this
    PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet
    contribution quality standards.

  • This functionality cannot be added in rust-vmm.

These unwraps were impossible to trigger due to preceding checks, but by
using some patterns matching in the checks instead, we can eliminate
them altogether.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Reduce number of unwraps/lock operations needed by using the `.entry()`
API for more idiomatic code.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Removes a handful of unwraps by slightly rearranging code (e.g. by using
pattern matching to combine the fallible operation with the check that
ensures it won't actually fail).

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.08%. Comparing base (b61a92a) to head (edcba5f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4622      +/-   ##
==========================================
- Coverage   82.14%   82.08%   -0.06%     
==========================================
  Files         255      255              
  Lines       31285    31256      -29     
==========================================
- Hits        25700    25658      -42     
- Misses       5585     5598      +13     
Flag Coverage Δ
4.14-c5n.metal 79.58% <100.00%> (-0.07%) ⬇️
4.14-c7g.metal ?
4.14-m5n.metal 79.56% <100.00%> (-0.07%) ⬇️
4.14-m6a.metal 78.79% <100.00%> (-0.07%) ⬇️
4.14-m6g.metal 76.63% <100.00%> (-0.08%) ⬇️
4.14-m6i.metal 79.56% <100.00%> (-0.06%) ⬇️
4.14-m7g.metal 76.63% <100.00%> (?)
5.10-c5n.metal 82.09% <100.00%> (-0.07%) ⬇️
5.10-c7g.metal ?
5.10-m5n.metal 82.08% <100.00%> (-0.07%) ⬇️
5.10-m6a.metal 81.39% <100.00%> (-0.07%) ⬇️
5.10-m6g.metal 79.39% <100.00%> (-0.08%) ⬇️
5.10-m6i.metal 82.08% <100.00%> (-0.06%) ⬇️
5.10-m7g.metal 79.40% <100.00%> (?)
6.1-c5n.metal 82.10% <100.00%> (-0.07%) ⬇️
6.1-m5n.metal 82.08% <100.00%> (-0.06%) ⬇️
6.1-m6a.metal 81.39% <100.00%> (-0.08%) ⬇️
6.1-m6g.metal 79.40% <100.00%> (-0.07%) ⬇️
6.1-m6i.metal 82.07% <100.00%> (-0.07%) ⬇️
6.1-m7g.metal 79.40% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roypat roypat merged commit 51cc5a4 into firecracker-microvm:main May 21, 2024
7 checks passed
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.

None yet

3 participants