-
Notifications
You must be signed in to change notification settings - Fork 565
vmm: Fix clippy lints #7552
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
vmm: Fix clippy lints #7552
Conversation
| .unwrap() | ||
| .landlock_enable | ||
| { | ||
| apply_landlock(self.vm_config.as_ref().unwrap().as_ref()) |
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 don't know if it would be possible to call apply_landlock with the given config before assigning it to self and setting console_info.
The changes I made preserve the current execution order.
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.
While on it: can we make this nicer with a if let Some(config) = self.vm_config.as_ref()).lock().unwrap() && config.landlock_enabled?
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.
The problem is that the apply_landlock function requires a &Mutex<VmConfig>.
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.
Should we refactor all &Mutex parmeters to instead consume a mutable reference to the underlying value? Sounds like a reasonable cleanup. Or would we lose something that way? This way callers must lock the Mutex therefore
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.
My impression is that, in this case, the apply_landlock method was introduced in order to more ergonomically deal with the wrapping Mutex (i.e. avoid needing to write .lock().unwrap() all over the place).
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.
a250ecf to
e76fff8
Compare
e76fff8 to
552c216
Compare
This PR fixes some clippy lints in the vmm crate. Signed-off-by: Oliver Anderson <[email protected]> On-behalf-of: SAP [email protected]
552c216 to
3f52dc1
Compare
rbradford
left a comment
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.
Let's land this to clear the CI redness
This PR fixes some clippy lints in the vmm crate.