mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
e295719967
commit
7536a95424
@@ -217,7 +217,7 @@ impl ConsoleEpollHandler {
|
||||
.write_slice(
|
||||
&source_slice[..],
|
||||
desc.addr()
|
||||
.translate_gva(self.access_platform.as_ref(), desc.len() as usize),
|
||||
.translate_gva(self.access_platform.as_deref(), desc.len() as usize),
|
||||
)
|
||||
.map_err(Error::GuestMemoryWrite)?;
|
||||
|
||||
@@ -253,7 +253,7 @@ impl ConsoleEpollHandler {
|
||||
.memory()
|
||||
.write_volatile_to(
|
||||
desc.addr()
|
||||
.translate_gva(self.access_platform.as_ref(), desc.len() as usize),
|
||||
.translate_gva(self.access_platform.as_deref(), desc.len() as usize),
|
||||
&mut buf,
|
||||
desc.len() as usize,
|
||||
)
|
||||
@@ -707,7 +707,7 @@ impl VirtioDevice for Console {
|
||||
interrupt_cb: Arc<dyn VirtioInterrupt>,
|
||||
mut queues: Vec<(usize, Queue, EventFd)>,
|
||||
) -> ActivateResult {
|
||||
self.common.activate(&queues, &interrupt_cb)?;
|
||||
self.common.activate(&queues, interrupt_cb.clone())?;
|
||||
self.resizer
|
||||
.acked_features
|
||||
.store(self.common.acked_features, Ordering::Relaxed);
|
||||
|
||||
Reference in New Issue
Block a user