Skip to content

Conversation

@simonsso
Copy link

@simonsso simonsso commented May 15, 2025

Summary of the PR

Remove panics with proper errors.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • [N/A] All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • [N/A] Any newly added unsafe code is properly documented.

@simonsso simonsso requested a review from mz-pdm as a code owner May 15, 2025 10:08
@simonsso simonsso force-pushed the patch-1 branch 2 times, most recently from 00ceb4d to d2a8aea Compare May 15, 2025 10:57
A few unwraps which may or may not be needed was replaced
with Result types.

Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
}

let backend = Arc::new(RwLock::new(backend_instance.unwrap()));
let backend = Arc::new(RwLock::new(backend_instance.map_err(|e| format!("{e}"))?));
Copy link
Member

Choose a reason for hiding this comment

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

format!("{e}") is unnecessary for types that implement std::fmt::Display, simply do:

map_err(|err| err.to_string())

Copy link
Author

Choose a reason for hiding this comment

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

I used the same code as other places in the file, I changed all of them now.

Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
Fredrik Simonsson added 2 commits May 15, 2025 16:57
Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
@simonsso simonsso requested a review from epilys May 16, 2025 08:04
@epilys epilys merged commit de03220 into rust-vmm:main May 16, 2025
2 checks passed
@epilys
Copy link
Member

epilys commented May 16, 2025

Thank you so much @simonsso!

@epilys
Copy link
Member

epilys commented May 16, 2025

Oops, I just realized the commits were not squashed together before merging. My bad, apologies.

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.

3 participants