-
Notifications
You must be signed in to change notification settings - Fork 74
Remove unwraps in vhost-device-scmi #836
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
Conversation
00ceb4d to
d2a8aea
Compare
A few unwraps which may or may not be needed was replaced with Result types. Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
vhost-device-scmi/src/main.rs
Outdated
| } | ||
|
|
||
| let backend = Arc::new(RwLock::new(backend_instance.unwrap())); | ||
| let backend = Arc::new(RwLock::new(backend_instance.map_err(|e| format!("{e}"))?)); |
There was a problem hiding this comment.
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())
There was a problem hiding this comment.
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>
Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
Signed-off-by: Fredrik Simonsson <fredrsim@axis.com>
|
Thank you so much @simonsso! |
|
Oops, I just realized the commits were not squashed together before merging. My bad, apologies. |
Summary of the PR
Remove panics with proper errors.
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.