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

@@ -221,7 +221,7 @@ impl VirtioCommon {
pub fn activate(
&mut self,
queues: &[(usize, Queue, EventFd)],
interrupt_cb: &Arc<dyn VirtioInterrupt>,
interrupt_cb: Arc<dyn VirtioInterrupt>,
) -> ActivateResult {
if queues.len() < self.min_queues.into() {
error!(
@@ -246,7 +246,7 @@ impl VirtioCommon {
// Save the interrupt EventFD as we need to return it on reset
// but clone it to pass into the thread.
self.interrupt_cb = Some(interrupt_cb.clone());
self.interrupt_cb = Some(interrupt_cb);
Ok(())
}