Skip to content

Conversation

@olivereanderson
Copy link
Contributor

This PR fixes some clippy lints in the vmm crate.

@olivereanderson olivereanderson requested a review from a team as a code owner December 9, 2025 13:44
.unwrap()
.landlock_enable
{
apply_landlock(self.vm_config.as_ref().unwrap().as_ref())
Copy link
Contributor Author

@olivereanderson olivereanderson Dec 9, 2025

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.

Copy link
Member

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?

Copy link
Contributor Author

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>.

Copy link
Member

@phip1611 phip1611 Dec 9, 2025

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

Copy link
Contributor Author

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).

Copy link
Member

Choose a reason for hiding this comment

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

FYI: I just set up #7555 which improves code IMHO a lot. I also tried to make this code a more idiomatic but eventually the borrow checker stopped me. Context.

@olivereanderson olivereanderson force-pushed the vmm-fix-clippy branch 2 times, most recently from a250ecf to e76fff8 Compare December 9, 2025 13:51
@olivereanderson olivereanderson changed the title clippy: Fix lints in the vmm crate. vmm: Fix clippy lints Dec 9, 2025
This PR fixes some clippy lints in the vmm crate.

Signed-off-by: Oliver Anderson <[email protected]>
On-behalf-of: SAP [email protected]
Copy link
Member

@rbradford rbradford left a 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

@rbradford rbradford added this pull request to the merge queue Dec 9, 2025
Merged via the queue into cloud-hypervisor:main with commit 8de24b5 Dec 9, 2025
43 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.

3 participants