mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: clippy: remove some overrides
Closes #4986 [0]. [0]: https://github.com/cloud-hypervisor/cloud-hypervisor/issues/4986 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
a8d1411307
commit
82e8002fa0
@@ -487,8 +487,7 @@ fn create_app(default_vcpus: String, default_memory: String, default_rng: String
|
|||||||
.args(args)
|
.args(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::needless_pass_by_value)]
|
fn start_vmm(cmd_arguments: &ArgMatches) -> Result<Option<String>, Error> {
|
||||||
fn start_vmm(cmd_arguments: ArgMatches) -> Result<Option<String>, Error> {
|
|
||||||
let log_level = match cmd_arguments.get_count("v") {
|
let log_level = match cmd_arguments.get_count("v") {
|
||||||
0 => LevelFilter::Warn,
|
0 => LevelFilter::Warn,
|
||||||
1 => LevelFilter::Info,
|
1 => LevelFilter::Info,
|
||||||
@@ -724,7 +723,7 @@ fn start_vmm(cmd_arguments: ArgMatches) -> Result<Option<String>, Error> {
|
|||||||
cmd_arguments.contains_id("kernel") || cmd_arguments.contains_id("firmware");
|
cmd_arguments.contains_id("kernel") || cmd_arguments.contains_id("firmware");
|
||||||
|
|
||||||
if payload_present {
|
if payload_present {
|
||||||
let vm_params = VmParams::from_arg_matches(&cmd_arguments);
|
let vm_params = VmParams::from_arg_matches(cmd_arguments);
|
||||||
let vm_config = VmConfig::parse(vm_params).map_err(Error::ParsingConfig)?;
|
let vm_config = VmConfig::parse(vm_params).map_err(Error::ParsingConfig)?;
|
||||||
|
|
||||||
// Create and boot the VM based off the VM config we just built.
|
// Create and boot the VM based off the VM config we just built.
|
||||||
@@ -886,7 +885,7 @@ fn main() {
|
|||||||
warn!("Error expanding FD table: {e}");
|
warn!("Error expanding FD table: {e}");
|
||||||
}
|
}
|
||||||
|
|
||||||
let exit_code = match start_vmm(cmd_arguments) {
|
let exit_code = match start_vmm(&cmd_arguments) {
|
||||||
Ok(path) => {
|
Ok(path) => {
|
||||||
path.map(|s| std::fs::remove_file(s).ok());
|
path.map(|s| std::fs::remove_file(s).ok());
|
||||||
info!("Cloud Hypervisor exited successfully");
|
info!("Cloud Hypervisor exited successfully");
|
||||||
|
|||||||
@@ -417,7 +417,6 @@ impl VsockPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(clippy::undocumented_unsafe_blocks)]
|
|
||||||
mod unit_tests {
|
mod unit_tests {
|
||||||
use virtio_bindings::virtio_ring::VRING_DESC_F_WRITE;
|
use virtio_bindings::virtio_ring::VRING_DESC_F_WRITE;
|
||||||
use virtio_queue::QueueOwnedT;
|
use virtio_queue::QueueOwnedT;
|
||||||
@@ -465,8 +464,9 @@ mod unit_tests {
|
|||||||
let hdr_gpa = guest_desc.addr.get();
|
let hdr_gpa = guest_desc.addr.get();
|
||||||
let hdr_ptr =
|
let hdr_ptr =
|
||||||
get_host_address_range(mem, GuestAddress(hdr_gpa), VSOCK_PKT_HDR_SIZE).unwrap();
|
get_host_address_range(mem, GuestAddress(hdr_gpa), VSOCK_PKT_HDR_SIZE).unwrap();
|
||||||
|
// SAFETY: The length is valid.
|
||||||
let len_ptr = unsafe { hdr_ptr.add(HDROFF_LEN) };
|
let len_ptr = unsafe { hdr_ptr.add(HDROFF_LEN) };
|
||||||
|
// SAFETY: The length is valid.
|
||||||
LittleEndian::write_u32(unsafe { std::slice::from_raw_parts_mut(len_ptr, 4) }, len);
|
LittleEndian::write_u32(unsafe { std::slice::from_raw_parts_mut(len_ptr, 4) }, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,6 @@ mod unit_tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::redundant_clone)]
|
|
||||||
fn bus_read_write() {
|
fn bus_read_write() {
|
||||||
let bus = Bus::new();
|
let bus = Bus::new();
|
||||||
let dummy = Arc::new(DummyDevice);
|
let dummy = Arc::new(DummyDevice);
|
||||||
@@ -322,7 +321,6 @@ mod unit_tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::redundant_clone)]
|
|
||||||
fn bus_read_write_values() {
|
fn bus_read_write_values() {
|
||||||
let bus = Bus::new();
|
let bus = Bus::new();
|
||||||
let dummy = Arc::new(ConstantDevice);
|
let dummy = Arc::new(ConstantDevice);
|
||||||
@@ -338,7 +336,6 @@ mod unit_tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::redundant_clone)]
|
|
||||||
fn busrange_cmp() {
|
fn busrange_cmp() {
|
||||||
let range = BusRange { base: 0x10, len: 2 };
|
let range = BusRange { base: 0x10, len: 2 };
|
||||||
assert_eq!(range, BusRange { base: 0x10, len: 3 });
|
assert_eq!(range, BusRange { base: 0x10, len: 3 });
|
||||||
|
|||||||
@@ -1235,12 +1235,10 @@ impl Vmm {
|
|||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::needless_pass_by_value)]
|
|
||||||
fn send_migration(
|
fn send_migration(
|
||||||
vm: &mut Vm,
|
vm: &mut Vm,
|
||||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))] hypervisor: Arc<
|
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||||
dyn hypervisor::Hypervisor,
|
hypervisor: &dyn hypervisor::Hypervisor,
|
||||||
>,
|
|
||||||
send_data_migration: &VmSendMigrationData,
|
send_data_migration: &VmSendMigrationData,
|
||||||
) -> result::Result<(), MigratableError> {
|
) -> result::Result<(), MigratableError> {
|
||||||
// Set up the socket connection
|
// Set up the socket connection
|
||||||
@@ -1265,12 +1263,10 @@ impl Vmm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let amx = vm_config.lock().unwrap().cpus.features.amx;
|
let amx = vm_config.lock().unwrap().cpus.features.amx;
|
||||||
let phys_bits = vm::physical_bits(
|
let phys_bits =
|
||||||
hypervisor.as_ref(),
|
vm::physical_bits(hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||||
vm_config.lock().unwrap().cpus.max_phys_bits,
|
|
||||||
);
|
|
||||||
arch::generate_common_cpuid(
|
arch::generate_common_cpuid(
|
||||||
hypervisor.as_ref(),
|
hypervisor,
|
||||||
&arch::CpuidConfig {
|
&arch::CpuidConfig {
|
||||||
phys_bits,
|
phys_bits,
|
||||||
kvm_hyperv: vm_config.lock().unwrap().cpus.kvm_hyperv,
|
kvm_hyperv: vm_config.lock().unwrap().cpus.kvm_hyperv,
|
||||||
@@ -2323,7 +2319,7 @@ impl RequestHandler for Vmm {
|
|||||||
Self::send_migration(
|
Self::send_migration(
|
||||||
vm,
|
vm,
|
||||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||||
self.hypervisor.clone(),
|
self.hypervisor.as_ref(),
|
||||||
&send_data_migration,
|
&send_data_migration,
|
||||||
)
|
)
|
||||||
.map_err(|migration_err| {
|
.map_err(|migration_err| {
|
||||||
|
|||||||
Reference in New Issue
Block a user