misc: cleanup &Arc<dyn T> -> &dyn T

Consuming `&Arc<T>` as argument is almost always an antipattern as it
hides whether the callee is going to take over (shared) ownership
(by .clone()) or not. Instead, it is better to consume `&dyn T` or
`Arc<dyn T>` to be more explicit. This commit cleans up the code.

The change is very mechanic and was very easy to implement across the
code base.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-10-28 10:49:34 +01:00
committed by Rob Bradford
parent e295719967
commit 7536a95424
37 changed files with 121 additions and 117 deletions

View File

@@ -1449,7 +1449,7 @@ impl VfioPciDevice {
#[allow(clippy::too_many_arguments)]
pub fn new(
id: String,
vm: &Arc<dyn hypervisor::Vm>,
vm: Arc<dyn hypervisor::Vm>,
device: VfioDevice,
container: Arc<VfioContainer>,
msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
@@ -1478,7 +1478,7 @@ impl VfioPciDevice {
let vfio_pci_device = VfioPciDevice {
id,
vm: vm.clone(),
vm,
device,
container,
common,

View File

@@ -69,7 +69,7 @@ impl VfioUserPciDevice {
#[allow(clippy::too_many_arguments)]
pub fn new(
id: String,
vm: &Arc<dyn hypervisor::Vm>,
vm: Arc<dyn hypervisor::Vm>,
client: Arc<Mutex<Client>>,
msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
@@ -103,7 +103,7 @@ impl VfioUserPciDevice {
Ok(Self {
id,
vm: vm.clone(),
vm,
client,
common,
memory_slot_allocator,