mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: clippy: add needless_pass_by_value
This is a follow-up of [0].
# Advantages
- This saves dozens of unneeded clone()s across the whole code base
- Makes it much easier to reason about how parameters are used
(often we passed owned Arc/Rc versions without actually needing
ownership)
# Exceptions
For certain code paths, the alternatives would require awkward or overly
complex code, and in some cases the functions are the logical owners of
the values they take. In those cases, I've added
#[allow(clippy::needless_pass_by_value)].
This does not mean that one should not improve this in the future.
[0] 6a86c157af
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
ed4af3a005
commit
c53781bf5f
@@ -131,7 +131,7 @@ fn import_parameter(
|
||||
/// Right now it only supports SNP based isolation.
|
||||
/// We can boot legacy VM with an igvm file without
|
||||
/// any isolation.
|
||||
///
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn load_igvm(
|
||||
mut file: &std::fs::File,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
|
||||
@@ -74,7 +74,7 @@ pub enum BootPageAcceptance {
|
||||
/// The startup memory type used to notify a well behaved host that memory should be present before attempting to
|
||||
/// start the guest.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum StartupMemoryType {
|
||||
/// The range is normal memory.
|
||||
Ram,
|
||||
|
||||
Reference in New Issue
Block a user